UILocalNotification isn't working at all

后端 未结 3 1587
故里飘歌
故里飘歌 2020-12-09 04:20

I\'m having some really irritating problems with UILocalNotification.

While finishing up an app that I\'ve nearly completed, I noticed that I couldn\'

3条回答
  •  粉色の甜心
    2020-12-09 04:57

    1. the fireDate must be future time.
    2. app must be running in backdrop, or is closed.
    3. one more thing, do not forget to show query whether to allow push, add below code to AppDelegate:

      -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
        if ([UIDevice currentDevice].systemVersion.floatValue >= 8.0) {
             UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound categories:nil]; 
             [application registerUserNotificationSettings:settings]; 
        }
      }
      

提交回复
热议问题