UILocalNotification IOS8 Badge Frage

  • UILocalNotification IOS8 Badge Frage

    Ich versuche in meiner App eine Badge-Anzeige am Icon hinzubekommen. Klappt nicht.

    Ich registriere in der didFinishLaunchingWithOptions folgendes:

    C-Quellcode

    1. #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
    2. if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
    3. UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
    4. [application registerUserNotificationSettings:settings];
    5. [application registerForRemoteNotifications];
    6. NSLog(@"1");
    7. } else {
    8. NSLog(@"2");
    9. [application registerForRemoteNotificationTypes: UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge];
    10. }
    11. #else
    12. NSLog(@"3");
    13. [application registerForRemoteNotificationTypes: UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge];
    14. #endif
    Alles anzeigen
    auf meinen Testgerät mit IOS8.3 kommt die 1 aus Zeile 6 - somit dürfte doch die Registrierung für den Empfang der Mitteilungen geklappt haben.

    Wenn ich nun versuche die Badge-Anzeige zu verändern bzw. erstmals zu setzen mit:


    C-Quellcode

    1. UIApplication *application = [UIApplication sharedApplication];
    2. application.applicationIconBadgeNumber = [model abfrageWert:@"SELECT SUM(ausschank) FROM kunden"];


    oder mit:

    C-Quellcode

    1. [[UIApplication sharedApplication] setApplicationIconBadgeNumber:[model abfrageWert:@"SELECT SUM(ausschank) FROM kunden"]];
    erhalte ich die Fehlermeldung:



    Attempting to badge the application icon but haven't received permission from the user to badge the application


    Also fehlt doch die Erlaubnis zu Empfang der Notification?

    Was mache ich falsch?