Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS push notification 馃殌 #219

Open
onmyway133 opened this issue Sep 22, 2016 · 6 comments
Open

iOS push notification 馃殌 #219

onmyway133 opened this issue Sep 22, 2016 · 6 comments

Comments

@onmyway133
Copy link
Owner

onmyway133 commented Sep 22, 2016

iOS app not show in Settings -> Notifications

  • It seems after app is deleted, currentUserNotificationSettings categories is remember

Check if user has enabled push notification

  • Check currentUserNotificationSettings
  • User can disable types at any time, so next time, check for push device token also. Or for sure, check for a flag in user defaults

User disable Allow Notifications in settings

  • didFailToRegisterForRemoteNotificationsWithError is called with

Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo={NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

  • didRegisterForRemoteNotificationsWithDeviceToken not called

User disables Sounds (.Sound), Badge (.Badge), Alert Style When Unlocked (.Alert)

  • types is None

Call registerForRemoteNotifications() without registerUserNotificationSettings

  • device token

Call registerForRemoteNotifications

  • didRegisterForRemoteNotificationsWithDeviceToken is called

If your application has previously registered, calling registerForRemoteNotificationTypes: results in the operating system passing the device token to the delegate immediately without incurring additional overhead

Call registerUserNotificationSettings

  • didRegister notificationSettings

The first time you register your settings, iOS waits for the user鈥檚 response before calling this method, but on subsequent calls it returns the existing user settings

@onmyway133 onmyway133 reopened this Sep 22, 2016
@onmyway133 onmyway133 changed the title iOS app not show in Settings -> Notifications iOS push notification Sep 22, 2016
@onmyway133
Copy link
Owner Author

onmyway133 commented Sep 22, 2016

Troubleshooting

Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.

@onmyway133
Copy link
Owner Author

onmyway133 commented Sep 29, 2016

Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo={NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

For Xcode 7, sometimes it caches or something, but toggling and disable push notification in Capabilities tab fixes the problem (and maybe run it). It won't change our entitlement, but toggle a flag in project file http://stackoverflow.com/questions/39554177/xcode-8-the-aps-environment-entitlement-is-missing-from-the-apps-signature-on

@onmyway133
Copy link
Owner Author

onmyway133 commented Sep 30, 2016

Device token

Device tokens can change, so your app needs to reregister every time it is launched and pass the received token back to your server

Your app should always ask for the device token by registering with the push service each time it is launched. Don't store a device token from your app and try to reuse it, because the token can change. Your provider should then pass that same token on to the push service.

@onmyway133
Copy link
Owner Author

@onmyway133
Copy link
Owner Author

onmyway133 commented Feb 9, 2017

isRegisteredForRemoteNotifications - UIApplication.shared.currentUserNotificationSettings

iOS 9.3.2, 10.1

  • Haven't trigger push request dialog: false - none
  • Enable push for app upon permission request: true - alert, badge, sound
  • Turn off push for app: true - none
  • Turn on push, enable only alert: true - alert
  • Uninstall and install again (within 24 hours): false - none
  • Deny upon asking upon permission request: true - none
  • Reenable push after denial: true - alert, badge, sound

@onmyway133 onmyway133 changed the title iOS push notification iOS push notification 馃殌 Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant