ich lokale Benachrichtigung auf iOS 9.x am Planen und aktualisieren Sie das Gerät auf iOS 10.Lokale Meldung erscheint nicht nach dem Upgrade von iOS 9.x auf iOS 10
Schritte:
- Register lokalen Benachrichtigung in iOS 9.x
- Schedule lokale Benachrichtigung auf iOS 9.x
- Beenden app
- Upgrade-Gerät auf iOS 10
- Warten lokale Benachrichtigung zu zeigen, aber es funktioniert nicht
-Code unten erscheinen:
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)])
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeSound|UIUserNotificationTypeBadge categories:nil]];
}
Schedule Benachrichtigungscode In didFinsihLaunchingWithOptions
if (errorRef != NULL) { *errorRef = nil; }
UILocalNotification * localNot = [[UILocalNotification alloc] init];
localNot.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
self.reminderId, REMINDER_ID_KEY_IN_LOCAL_NOTIF,
aOcc.repeatId, REPETITION_ID_KEY_IN_LOCAL_NOTIF,
@(index), SNOOZE_INDEX,
nil];
localNot.fireDate = [NSDate dateWithTimeInterval:(index * SNOOZE_INTERVAL * 60) sinceDate:aOcc.startTime];
localNot.repeatInterval = aOcc.repeatInterval; // NSCalendarUnitWeekOfYear
localNot.timeZone = aOcc.timeZone; // system timezone
if (aOcc.messageStr != nil && [aOcc.messageStr length] > 0)
{
localNot.alertBody = aOcc.messageStr;
}
if (self.soundFlag == YES)
{
if (self.soundFileName != nil && [self.soundFileName length] > 0)
{
localNot.soundName = [[NSString alloc]initWithFormat:@"%@.%@",self.soundFileName,kDefaultSoundFileExtension];
}
}
[[UIApplication sharedApplication] scheduleLocalNotification:localNot];
if (aOcc.snoozeArray == nil)
{
aOcc.snoozeArray = @[localNot];
}
else
{
aOcc.snoozeArray = [aOcc.snoozeArray arrayByAddingObject:localNot];
}
[self.repetitions setObject:aOcc forKey:aOcc.repeatId];
[[RemindersManager sharedInstance] save];
return localNot;
Nach tiefen Einblick in Protokolle, Ich finde Instanz von Sep 28 18:44:05 iPhone SpringBoard (UserNotificationsServer) [57]: [XXXXXXXXXX] Benachrichtigungen aktivieren: 0 [authorizationOptions: 7]
Bitte helfen Sie. Danke im Voraus.