IT

앱의 푸시 알림 설정 재설정

lottoking 2020. 5. 25. 22:22
반응형

앱의 푸시 알림 설정 재설정


푸시 알림이있는 앱을 개발 중입니다. 가능한 모든 사용자 상호 작용 방법을 확인하기 위해 사용자가 처음 시작할 때 내 앱에 푸시 알림을 사용하도록 설정하지 않은 경우 내 앱을 테스트하고 싶습니다.

그러나 대화 상자 (로 시작 registerForRemoteNotificationTypes)는 앱당 한 번만 나타납니다. 내 앱의 iPhone OS 메모리를 어떻게 재설정합니까? 앱을 삭제하고 다시 설치해도 도움이되지 않습니다.


기술 노트 TN2265 : 푸시 알림 문제 해결

푸시 사용 앱이 처음으로 푸시 알림을 등록하면 iOS는 사용자에게 해당 앱에 대한 알림을받을 것인지 묻습니다. 사용자가이 경고에 응답하면 기기를 복원하거나 앱을 하루 이상 제거하지 않으면 다시 표시되지 않습니다.

앱의 최초 실행을 시뮬레이션하려면 하루 동안 앱을 제거 된 상태로 둘 수 있습니다. 시스템 시계를 하루 이상 앞으로 설정하고 장치를 완전히 끈 다음 장치를 다시 켜면 실제로 하루를 기다리지 않고 후자를 얻을 수 있습니다.

업데이트 : 아래 의견에서 언급 했듯이이 솔루션은 iOS 5.1부터 작동을 멈췄습니다. Apple에서 문서를 업데이트 할 수 있도록 버그를 신고하는 것이 좋습니다. 현재 솔루션은 장치의 내용과 설정을 재설정하는 것 같습니다.

업데이트 : 기술 노트가 iOS 7부터 올바르게 작동하는 새로운 단계로 업데이트되었습니다.

  1. 기기에서 앱을 삭제합니다.
  2. 장치를 완전히 껐다가 다시 켜십시오.
  3. 설정> 일반> 날짜 및 시간으로 이동하여 하루 이상 날짜를 설정하십시오.
  4. 장치를 완전히 껐다가 다시 켜십시오.

iOS 9부터 업데이트

단순히 앱을 삭제하고 다시 설치하면 알림 상태가 재설정됩니다 notDetermined(즉, 프롬프트가 표시됨).

아래의 Gomfucius의 답변 덕분에 https://stackoverflow.com/a/33247900/704803


이것 에 대한 솔루션을 테스트 하기 위한 또 다른 방법은 단순히 번들 ID를 변경하는 것입니다. 완료되면 다시 변경하는 것을 잊지 마십시오!


iOS 9.0.2에서는 앱을 삭제하고 다시 설치할 때마다 "푸시 알림 등록 알림"이 표시됩니다. 이는 AppStore 프로덕션 다운로드 및 임시 모드 모두에 해당됩니다.

업데이트 : 이것이 iOS 9.x에서 작동하는 것으로 확인되었습니다.


이미 언급했듯이 장치의 앱에 대한 알림 상태를 재설정하는 방법은 iOS5에서 더 최신으로 변경되었습니다.

이것은 iOS6에서 저에게 효과적입니다.

  • 기기에서 앱 제거
  • 장치 날짜 시간을 이틀 이상 설정
  • 장치를 다시 시작
  • 장치 날짜 시간을 이틀 이상 설정
  • 장치를 다시 시작
  • 앱을 다시 설치하고 실행하십시오.

그러나 이렇게하면 초기 프롬프트 만 다시 나타나게되며 다른 푸시 상태 관련 항목은 제거되지 않습니다.


plist : /private/var/mobile/Library/RemoteNotification/Clients.plist

... 푸시 알림에 등록 된 클라이언트를 포함합니다. 앱 항목을 제거하면 프롬프트가 다시 나타납니다.


프로그래밍 방식으로하면 매번 작동하는 것 같습니다. 다음 줄을 주석 처리하지 않은 빌드가 있습니다.

 [[UIApplication sharedApplication] unregisterForRemoteNotifications];

PN에서 등록을 취소 할 때마다 실행합니다. 최근 앱 목록에서 앱을 명시 적으로 종료하고 설정 앱의 알림 센터를 사용하여 제대로 작동해야 할 수 있습니다.

또한 사용자에게 PN 등록을 요청하는 UI 프롬프트가 표시되지 않을 수 있습니다. 최신 iOS 버전에서 사용 중지되었는지 확실하지 않습니다.


ianolito가 말했듯이 날짜 설정은 효과가 있습니다.

시스템 시계를 하루 이상 앞으로 설정하고 장치를 완전히 끈 다음 장치를 다시 켜면 실제로 하루를 기다리지 않고 후자를 얻을 수 있습니다.

내 기기 (iPhone 4, iOS 6.1.2) 에서 하루 또는 몇 일 동안 시스템 시계를 설정해 도 작동하지 않는 것으로 나타났습니다 . 그래서 날짜를 한 달 앞으로 설정 한 다음 작동했고 응용 프로그램에 알림 메시지가 다시 표시되었습니다.

이것이 누군가에게 도움이되기를 바랍니다. 머리가 아플 수 있습니다!


micmdk에 동의합니다. 푸시 알림을 사용하여 개발 환경을 설정했으며 초기 설치처럼 보이도록 휴대 전화를 재설정하는 방법이 필요했습니다.이 정확한 단계 만 수행하면됩니다. 장치를 두 번 재부팅해야합니다.

APPLE TECH DOC에서 :

iOS에서 푸시 알림 권한 경고 재설정 푸시 가능 앱이 푸시 알림을 처음 등록하면 iOS는 사용자에게 해당 앱에 대한 알림을받을 것인지 묻습니다. 사용자가이 경고에 응답하면 기기를 복원하거나 앱을 하루 이상 제거하지 않으면 다시 표시되지 않습니다.

앱의 첫 실행을 시뮬레이트하려면 하루 동안 앱을 제거 된 상태로 둘 수 있습니다. 다음 단계에 따라 실제로 하루를 기다리지 않고 후자를 얻을 수 있습니다.

  1. 기기에서 앱을 삭제합니다.

  2. 장치를 완전히 껐다가 다시 켜십시오.

  3. 설정> 일반> 날짜 및 시간으로 이동하여 하루 이상 날짜를 설정하십시오.

  4. 장치를 완전히 껐다가 다시 켜십시오.


나는 과거에 이것에 대해 궁금해했으며 실제로 내 코드에 유효한 테스트 사례가 아니라는 결론에 도달했습니다. 응용 프로그램 코드가 실제로 알림을 처음 거부하거나 나중에 iPhone 알림 설정에서 비활성화하는 사람의 차이점을 알 수 있다고 생각하지 않습니다. 사용자 환경이 다르지만 registerForRemoteNotificationTypes 호출 안에 숨겨져 있다는 것은 사실입니다.

Calling unregisterForRemoteNotifications does not completely remove the application from the notifications settings - though it does remove the contents of the settings for that application. So this still will not cause the dialog to be presented a second time to the user the next time the app runs (at least not on v3.1.3 that I am currently testing with). But as I say above you probably should not be worrying about that.


The same tech note as refered to in the accepted answer (TN2265 - Troubleshooting Push Notifications) has since been updated with a solution for iOS 5 and above.

In short: create a backup and restore from it every time.

On iOS 5 and later, reset the push notifications permissions alert by restoring the device from a backup (r. 11450187). Here are the steps to do this efficiently:

  1. Use the Xcode Organizer to install your app on the device. The key is to install the app for the first time without running it.
  2. Use iTunes to back up the device.
  3. Run the app. The push notifications permissions alert will be presented.
  4. When you want to reset the push notifications permissions alert, restore the device from the backup you created in the first step.

The Apple Tech Note also described you can restore the device to reset the Push Notification dialog.

It does not say that you can also use the option "General -> Reset -> Erase All Content And Settings" on the device itself (iOS 5.x).


In addition to the answer of ianolito.

Had the same issue with an app I downloaded a year ago and denying push notification initially. Now wanting push notifications back, these steps worked for me on iOS 7 beta. Not sure which point(s) triggered it exactly.

  • Close and delete the app.
  • Go to your iCloud settings and delete the app from the iCloud. Do this on all other devices where you have iCloud backup for apps enabled. After deactivating and deleting make a fresh backup. The app should not be listed any more under the backups. (This is maybe why the Technical Note from Apple described by ianolito stopped working in iOS 5, since iCloud was introduced in iOS 5 and many have iCloud backup for apps enabled.)
  • Go to your time settings and set the time more than 1 month ahead.
  • Switch the iPhone off (no reset).
  • Wait a minute, switch it on again and download the app again.
  • Start the app and I was presented the dialog again.
  • Enable app backup again, since it is still deactivated. Correct the time.

Thank god I did not have to "Erase All Content And Settings". Maybe it will help someone.


I recently ran into the similar issue with react-native application. iPhone OS version was 13.1 I uninstalled the application and tried to install the app and noticed both location and notification permissions were not prompted.

On checking the settings, I could see my application was enabled for location(from previous installation) however there was no corresponding entry against the notification Tried uninstalling and rebooting without setting the time, it didn't work. Btw, I also tried to download the Appstore app, still same behavior.

The issue was resolved only after setting the device time.


After hours of searching, and no luck with the suggestions above, this worked like to a charm for 3.x+

override func viewDidLoad() {
        super.viewDidLoad()


            requestAuthorization()

}

func requestAuthorization() {

        if #available(iOS 10.0, *) {

            UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in
                print("Access granted: \(granted.description)")
            }

        } else {
            // Fallback on earlier versions
        }

    }

참고URL : https://stackoverflow.com/questions/2438400/reset-push-notification-settings-for-app

반응형