I am implement ios APNS , I write the code in AppDelegate.m, and pass the device token to my view controller( Use NSUserDefaults) .
Then there are a button in view controller, when user click the button , it will send device token to my server.
But the question is coming. If the user is not connect Internet, the button action will detect the device token is null or not.
When the device token is null, the app have to detected network and request device token.
But the device token is wrote in AppDelegate.m, how to implement registered device token in the class alone?
Thank you very much.
I found the resolve.
Setting the code in applicationDidBecomeActive.