Wie behebt man dieses Problem? Dies ist mein Code:Objective-C: Ärgerlich - ich bekomme ca. 5-6 Benachrichtigungen pro Minute von meinem UILocalNotifications
NSDate *dateToSet = [NSDate dateWithTimeIntervalSinceNow:1.0];
NSString *message = @"Test notification";
UILocalNotification *warningNotification = [[UILocalNotification alloc] init];
warningNotification.fireDate = dateToSet;
warningNotification.timeZone = [NSTimeZone defaultTimeZone];
warningNotification.alertBody = message;
warningNotification.hasAction = NO;
warningNotification.userInfo = nil;
warningNotification.repeatInterval = NSCalendarUnitDay;
warningNotification.soundName = nil;
[[UIApplication sharedApplication] scheduleLocalNotification:warningNotification];
Und mein AppDelegate.m (didFinishLaunchingWithOptions):
UIUserNotificationType types = UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *mySettings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
}
[[UIApplication sharedApplication] scheduledLocalNotifications];
[application registerForRemoteNotifications];
Was macht diese Zeile: '[[UIApplication sharedApplication] planedLocalNotifications];'? – Avi
Eigentlich bin ich neu bei UILocalNotifications, das ist mein erstes Mal, dass ich es für meine neue App verwende, ich habe diese Codes aus Tutorials im Internet hinzugefügt (nicht von mir selbst). –