iOS 9でアプリケーションバッジ番号を設定する 質問する

iOS 9でアプリケーションバッジ番号を設定する 質問する

私は使っていた

[UIApplication sharedApplication].applicationIconBadgeNumber = 5;

アプリケーションバッジ番号の設定用。iOS 9だけでは動作しません。

誰か理由を教えてもらえますか?

私は試した、

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:5];

ベストアンサー1

こんにちは UIUserNotificationSettingsを次のように登録する必要があります

UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];

[UIApplication sharedApplication].applicationIconBadgeNumber = 1;

おすすめ記事