Disabling Push Notifications in iOS 10

Hi,

I can enable and receive test notifications in the iOS Sample app. When I try to disable them (on an iPhone running iOS 10.3.2) the switch flips just fine, but it does not change the status to inactive (even if I leave that view visible for multiple minutes). I have to background and reopen the Sample app for that change to be sent up, even though reactivating is handled as soon as the switch is flipped. I was experiencing similar in the app I'm adding UA to.

I'm using the most recent version of the Sample app: https://github.com/urbanairship/ios-library/tree/master/Sample. Any help would be appreciated.

Thanks,

Jason

Didn't find what you were looking for?

New post

Comments

5 comments

  • Hi Jason,

    This is expected behavior in the Sample App.

    When you flip that switch, it will not immediately make the registration update until you leave that screen. So, that can be backgrounding and then foregrounding the app, or navigating to some other screen in the app.

    The reason for this is because if you allow registration updates to be made immediately when that flip is switched, you can also immediately flip the switch off and on multiple times, resulting in many registration updates, of which only the latest update that goes through will be "counted" in our system. So, you could end up with a case of an incorrect opt-in status.

    So, those registration updates are made only when you leave the screen, thereby preventing that situation from happening. 

    0
  • Hi Michael,

    Thanks for getting back to me!

    Looking at the documentation, it only shows the call to change:

    [UAirship push].userPushNotificationsEnabled

    in order to modify the active/inactive status in Urban Airship (I'm not sure if the documentation is out of date and missing additional setup). Is there a different call that I will need to make within my app to get it to fire the call to change the device's status to inactive? I couldn't tell which call in the sample app is making that update happen.

    The reason I want the update to happen before they background or close the app is because if the user closes the app after toggling the switch to disable notifications, they will still receive them until they come back to the app (which can be a long span of time).

    Thanks,

    Jason

    0
  • Jason,

    Try giving the updateRegistration call a shot, that should update the device if anything on it has changed, which should include its registration status.

    1
  • Awesome, that was it! Many thanks!

    0
  • No problem, happy to help!

    0

Please sign in to leave a comment.