我的简单UILocalNotification没有解雇

时间:2016-09-28 08:47:58

标签: ios objective-c uilocalnotification

\Q

为什么我的简单UILocalNotification没有被解雇?

2 个答案:

答案 0 :(得分:0)

您是否已将此代码添加到didFinishLaunchingWithOptions

AppDelegate
UIUserNotificationType types = (UIUserNotificationType) (UIUserNotificationTypeBadge |
             UIUserNotificationTypeSound | UIUserNotificationTypeAlert);

UIUserNotificationSettings *mySettings =
            [UIUserNotificationSettings settingsForTypes:types categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];

我不确定你是否添加了,但是如果你错过了这个,你就永远不会得到本地和远程通知。

答案 1 :(得分:0)

您必须注册通知设置对于本地和远程通知,请先注册通知设置。