objective c - ios DeviceToken: How to pass deviceToken from AppDelegate to ViewController? -


I am facing some strange issues actually view the AppDelegate ViewDidLoad method of controller didRegisterForRemoteNotificationsWithDeviceToken Method

Before the code is said in AppDelegate as follows

  - (zero) Application: (UIApplication *) Application for the Controller Information NotificationVideoTokenToken: (NSDTA) DeviceToken {NSLOG (@ "My Token:% @", DeviceToken); NSString * newToken = [tool token description]; NewToken = [NewToken stringBitramingCarsatsat: [NSCRactorSat CharacterSatWithServerInstring: @ " & gt;"]] ;; NewToken = [NewToken stringBeerPlleaningOurrenceOffString: @ "" with string: @ ""]; NSLog (@ "Tokens:% @", newToken); NSUserDefaults * Default Values ​​= [NSUserDefaults Standard User Defaults]; [Set default value: for new token: key_device_token]; [Synchronize default values]; }   

Code viewedload method

  - (zero) viewDidoadload {[Super Viewedload]; NSLog ("ABCD" @); }   

The console output is

2

  014-10-10 16:59: 15.590 Follow [650: 60b] ABCD 2014-10-10 16: 59: 15.592 in the follow up [650: 60b] AP DIR: File: /// var / Mobile / Application / 94B3FF 5 EBC B-4FB-99A7-2 DFBDC30 ECB / Document / 2014-10-10 16: 59: 15.693 in the follow [650: 60b] My token is: & lt; 3ff5f77 d15d7680 f8028b92 d1ebaf9b 06457115 336f1ee5 56172de6 5d8217c5 & gt; 2014-10-10 16: 59: 15.695 follow [650: 60b] token: 3fff5f77d15d7680f8028b92d1ebaf9b06457115336f1ee556172de65d8217c5   

Can anyone tell me what's the problem with my code?

  1. Use NSUserdefault, file, database (SQLite, Coredata, file etc.) Can save tokens, simple, you can keep it in global variable, singleton ...
  2. Push to notify when you are registered for app deleaget success for remote information You can use notifications.
  3. You register a protocol to listen to the app, register the success of the representative for remote information.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -