How to manage iOS apns token changes

我怕爱的太早我们不能终老 提交于 2019-12-03 06:37:37

This is how we ended up solving it:

On each app launch:

  1. create push notification token
  2. is there a token in localstorage?
    • yes - compare the tokens to localstorage. are they identical?
      • yes - return
      • no - update server with new token, and after server response with 'OK' save it locally in local storage and keychain
    • no - check is there a token in keychain
      • yes - compare the tokens to keychain. are they identical?
        • yes - save token in localstorage and return
        • no - update server with new token, and after server response with 'OK' save it locally in local
          storage and keychain
    • no - update server with new token, and after server response with 'OK' save it locally in local storage and keychain

If anyone has a more elegant way to solve it I would love to hear about it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!