iOS本地推送

2021-12-02  本文已影响0人  逍遥庄主

import <UserNotifications/UserNotifications.h>

<UNUserNotificationCenterDelegate>

UNUserNotificationCenter *notiCenter = [UNUserNotificationCenter currentNotificationCenter];
notiCenter.delegate = self;
//用户授权
[notiCenter requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (granted) {
NSLog(@"注册成功");
dispatch_async(dispatch_get_main_queue(), ^{
[application registerForRemoteNotifications];
});
}
}];
//获取当前通知设置
[notiCenter getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {

}];

// iOS 10收到通知 代理方法

// 通知的点击事件

//实现本地通知方法调用

上一篇 下一篇

猜你喜欢

热点阅读