首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏学海无涯

    iOS17适配指南之其他细节

    view.addSubview(scrollView) } } applicationIconBadgeNumber UIApplication 的applicationIconBadgeNumber属性被废弃,建议使用UNUserNotificationCenter.current { // iOS17之后设置角标,需要先授权 // UNUserNotificationCenter.current().setBadgeCount(10) UNUserNotificationCenter.current().setBadgeCount(10) { error in if let error {

    1.2K30编辑于 2023-09-01
  • 来自专栏APP自动化测试

    iOS集成友盟推送

    systemVersion] floatValue] < 10.0) { } else { //如果是iOS 10以上版本则必须执行以下操作 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate [alertView show]; } } //iOS10新增:处理前台收到通知的代理方法 - (void)userNotificationCenter:(UNUserNotificationCenter UNNotificationPresentationOptionAlert); } //iOS10新增:处理后台点击通知的代理方法 -(void)userNotificationCenter:(UNUserNotificationCenter

    2.7K20发布于 2019-10-15
  • 来自专栏正则

    UserNotifications API

    相关类库介绍 UserNotifications 模块主要涉及到以下一些类库 用户通知中心 UNUserNotificationCenter 主要管理通知相关的调度,添加,其相关的属性和方法如下 // for the current application open class func current() -> UNUserNotificationCenter // 请求通知的权限 @available(iOS 10.0, *) optional public func userNotificationCenter(_ center: UNUserNotificationCenter @available(iOS 10.0, *) optional public func userNotificationCenter(_ center: UNUserNotificationCenter If you have obtained this attachment from UNUserNotificationCenter then the URL will be security-scoped

    1.2K40发布于 2021-11-04
  • 来自专栏学海无涯

    iOS14开发- 通知

    将UNNotificationRequest添加到UNUserNotificationCenter。 案例 申请授权(异步操作)。 -> Bool { // 请求通知权限 UNUserNotificationCenter.current() .requestAuthorization(options: -> Bool { // 请求通知权限 UNUserNotificationCenter.current() .requestAuthorization NSObject, UNUserNotificationCenterDelegate { // 前台展示通知 func userNotificationCenter(_ center: UNUserNotificationCenter -> Bool { // 设置代理 UNUserNotificationCenter.current().delegate = notificationHandler

    2.3K31发布于 2021-11-24
  • 来自专栏freesan44

    iOS15 发送本地通知(附带声音)无法播报

    content.body = @" 不能为空"; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter

    1.9K40发布于 2021-11-05
  • 来自专栏java架构1+1

    iOS 10 消息推送(UserNotifications)秘籍总结

    *center = [UNUserNotificationCenter currentNotificationCenter]; //必须写代理,不然无法监听通知的接收与点击事件 center.delegate before the application returns from applicationDidFinishLaunching:. - (void)userNotificationCenter:(UNUserNotificationCenter - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse 推送请求添加到推送管理中心(UNUserNotificationCenter)中 1、新功能trigger可以在特定条件触发,有三类:UNTimeIntervalNotificationTrigger、 * center = [UNUserNotificationCenter currentNotificationCenter]; // 将通知请求 add 到 UNUserNotificationCenter

    3.5K40发布于 2019-06-19
  • 来自专栏freesan44

    iOS15 发送本地通知(附带声音)无法播报

    content.body = @" 不能为空"; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter

    1.4K20编辑于 2021-12-06
  • 来自专栏月亮与二进制

    iOS 10前后两种本地通知

    iOS 10以上系统的实现 iOS 10以前使用UILocalNotification,iOS开始支持一个新的类库UNUserNotificationCenter,都给了他特定的前缀UN了,可见重视程度 UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // 注册通知 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center requestAuthorizationWithOptions *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; UNMutableNotificationContent 然后就可以处理接收通知: #pragma mark - UNUserNotificationCenterDelegate // iOS 10收到通知 - (void)userNotificationCenter:(UNUserNotificationCenter

    1.7K20发布于 2021-11-23
  • 来自专栏APP自动化测试

    AppDelegate减负之常用三方封装 - 友盟推送篇

    currentDevice] systemVersion] floatValue] >= 10.0) { // 如果检查到时iOS 10以上版本则必须执行以下操作 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate nil]; [alertView show]; } } // iOS 10新增: 处理前台收到通知的代理方法 - (void)userNotificationCenter:(UNUserNotificationCenter UNNotificationPresentationOptionAlert); } //iOS10新增:处理后台点击通知的代理方法 -(void)userNotificationCenter:(UNUserNotificationCenter

    1K110发布于 2019-10-15
  • 来自专栏一“技”之长

    iOS10通知框架UserNotification理解与应用

            要在iOS系统中使用通知,必须获取到用户权限,UserNotification框架中申请通知用户权限需要通过UNNotificationCenter来完成,示例如下: //进行用户权限的申请 [[UNUserNotificationCenter /在block中会传入布尔值granted,表示用户是否同意 if (granted) { //如果用户权限申请成功,设置通知中心的代理 [UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObjects:category, nil]]; [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObjects:category, nil]]; [[UNUserNotificationCenter _WATCHOS_AVAILABLE(3.0); /* 这个方法当接收到通知后,用户点击通知激活app时被调用,无论前台还是后台 */ - (void)userNotificationCenter:(UNUserNotificationCenter

    2.3K31发布于 2018-08-15
  • 来自专栏進无尽的文章

    推送-iOS本地通知

    User Notifications Framework类关系图 重点介绍: UNUserNotificationCenter通知中心,用以管理通知的注册、权限获取和管理、通知的删除与更新,通过代理分发事件等 UNNotification 通知实体,在UNUserNotificationCenter的代理回调事件中,告知App接收到一条通知,包含一个发起通知的请求UNNotificationRequest UNNotificationRequest super viewDidLoad]; if ([[UIDevice currentDevice] systemVersion].floatValue >= 10.0) { UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; requestWithIdentifier:@"KFGroupNotification" content:content trigger:trigger]; // 4、将请求加入通知中心 [[UNUserNotificationCenter

    8.7K30发布于 2018-09-12
  • 来自专栏腾讯技术工程官方号的专栏

    iOS 推送手机消息背后的技术

    相关代码如下: #import <UserNotifications/UserNotifications.h> …… [[UNUserNotificationCenter currentNotificationCenter 每个Request对象都需要配置一个id来标识该条推送内容,UNUserNotificationCenter通过该id来管理(包括增加、删除、查询和修改)所有的Request。        requestWithIdentifier:@"testId" content:content trigger:calendarTrigger]; //将推送请求添加到管理中心才会生效 UNUserNotificationCenter * center = [UNUserNotificationCenter currentNotificationCenter]; [center addNotificationRequest:request         [PageSwitch handlePushSwitch:params];     } } //用户点击推送消息的回调 - (void)userNotificationCenter:(UNUserNotificationCenter

    4.9K103发布于 2020-10-27
  • 来自专栏雨尘分享

    iOS 点击推送消息跳转指定界面 —总结篇app 在后台app被杀死

    @param center 、 @param response 、 @param completionHandler 、 */ - (void)userNotificationCenter:(UNUserNotificationCenter requestWithIdentifier:@"NotificationDefault" content:content trigger:trigger]; //添加通知请求 [[ UNUserNotificationCenter didReceiveLocalNotification:(UILocalNotification *)notification iOS 10 之后 - (void)userNotificationCenter:(UNUserNotificationCenter fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler ios 10之后 - (void)userNotificationCenter:(UNUserNotificationCenter

    9K71发布于 2018-06-07
  • 来自专栏iOS开发攻城狮的集散地

    iOS 前台重启应用和清除角标的问题已知条件:问题描述:调试分析解决问题

    UINavigationController alloc] initWithRootViewController:[[ViewController alloc] init]]; //注册通知 UNUserNotificationCenter * center = [UNUserNotificationCenter currentNotificationCenter]; //设置代理,用于检测点击方法 center.delegate 收到通知(本地和远端) UNUserNotificationCenterDelegate //当APP处于前台的时候收到通知的事件 - (void)userNotificationCenter:(UNUserNotificationCenter

    2.2K30发布于 2019-01-03
  • 来自专栏freesan44

    iOS15 推送动态语音播报解决方案

    audioAsset.duration; float audioDurationSeconds = CMTimeGetSeconds(audioDuration); UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; UNMutableNotificationContent

    1.5K40编辑于 2022-04-02
  • 来自专栏freesan44

    iOS15 推送动态语音播报解决方案

    audioAsset.duration; float audioDurationSeconds = CMTimeGetSeconds(audioDuration); UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; UNMutableNotificationContent

    1.5K20编辑于 2021-12-29
  • 来自专栏Rindew的iOS技术分享

    iOS初步集成极光推送后你还要做这些事

    接收到通知消息首先会调用极光的这个代理 #pragma mark- JPUSHRegisterDelegate // iOS 10 Support - (void)jpushNotificationCenter:(UNUserNotificationCenter // iOS 10 Support - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse 在后台的时候 // iOS 10 Support - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse completionHandler(); // 系统要求执 这个 法 } 在前台的时候 // iOS 10 Support - (void)jpushNotificationCenter:(UNUserNotificationCenter

    3.6K50发布于 2018-06-14
  • 来自专栏freesan44

    Objective-C的hook方案/ Method Swizzling

    else { method_exchangeImplementations(originalMethod, swizzledMethod); } } @implementation UNUserNotificationCenter

    48910发布于 2020-08-11
  • 来自专栏各类技术文章~

    iOS15适配本地通知功能及语音播报探索

    content.body = @" 不能为空"; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter

    4.3K30发布于 2021-11-05
  • 来自专栏移动端开发

    个推你应该这样用的

    floatValue] >= 10.0) { #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 // Xcode 8编译会调用 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self;

    2.4K90发布于 2018-01-12
领券