【发布时间】:2020-05-20 07:45:48
【问题描述】:
UNUserNotificationCenter *notificaitnCenter = [UNUserNotificationCenter currentNotificationCenter];
[notificaitnCenter requestAuthorizationWithOptions:UNAuthorizationOptionBadge | UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionProvidesAppNotificationSettings completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (granted) {
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] registerForRemoteNotifications];
});
}
}];
在实现这个 sn-p 代码后,我也看不到通知设置选项。
【问题讨论】:
-
您是否在项目
Signing & Capabilities配置中添加了推送通知功能? -
是的,我已启用它。
标签: ios objective-c xcode push-notification unusernotification