起動が完了した後、私たちのアプリ内でプッシュ通知を有効または無効にする必要があります。私はこの機能を起動後、そして私のアプリの "アカウント設定"で行います起動が完了した後、またはアプリ内でプッシュ通知を有効/無効にする
私は以下のコードを試しましたが、うまくいきません。
if (cell.switchButton.on) {
if ([[UIApplication sharedApplication]respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
}
else {
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
}
私の要件:私は、有効または無効通知トグルを自分のアプリケーション内のプログラムではなく、直接設定に行く - >通知。
何のエラー以下のように設定アプリのオープン通知セクション?説明してください – Shubhank
無効にした後に一度チェックしてください設定ページで完了しましたか? –