0

Previously, when building my app using the iOS 9 SDK, the push notification authorization request alert (that system alert which says: "App" Would Like to Send You Notifications ... Don't Allow / Allow) would only show when I called [[UIApplication sharedApplication] registerForRemoteNotifications].

We've decided to actually only do that at a certain point in the game, so the user is only encouraged to allow push notifications when it makes sense.

On iOS 10, I understand we must use the User Notifications framework to accomplish that (by calling requestAuthorizationWithOptions:completionHandler: on [UNUserNotificationCenter currentNotificationCenter]), enable Push Notification on the app Capabilities and setup the entitlements. And that does work on some devices, but not all of them.

On some devices, the authorization request is presented to the user right at app launch even though I did not call requestAuthorizationWithOptions:completionHandler: or registerForRemoteNotifications at any point yet.

The weirdest part is that this happens consistently on some devices (running iOS 10.1.1 or 10.2 beta), even if I install the AppStore version of the app (which was built using Xcode 7 and iOS 9 SDK).

Should I assume this is a bug of iOS 10? I couldn't find other people with the same issue, only a kinda similar issue here.

Community
  • 1
  • 1
leolobato
  • 2,359
  • 3
  • 32
  • 51
  • Did you try to see what is the status of Notification Settings in Settings App of Device? – Pranav Jaiswal Nov 28 '16 at 23:42
  • Before the app is installed, it is not visible. When the system alert is displayed at app launch, it is off at device settings (but maybe because I had to switch from the app to device settings while the alert was visible, and it is dismissed). If I had tapped "allow" on the system alert on app launch, notifications are enabled. – leolobato Nov 29 '16 at 09:39

2 Answers2

0

The issue is actually a change from iOS 9 to iOS 10 on Game Center's [GKLocalPlayer localPlayer].authenticateHandler.

When it is set, it will trigger a push notification permission request on iOS 10. This did not happen on iOS 9.

leolobato
  • 2,359
  • 3
  • 32
  • 51
0

For anyone stumbling upon this and not finding the above answer to have been the cause of their problem, it should be noted that attempting to change the app badge will also result in a Push Notification request.

My personal situation was regarding a Cordova app, where I was loading and applying the badge plugin before initialising push, and couldn't work out why the Notification permission dialog was appearing on app launch.