Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>there are a few simple steps you need to follow:</p> <ol> <li><p>in your app delegate's didFinishLaunchingWithOptions you should register for remote notifications. notice that apple's documentations suggests to register each time the app runs since the token may change from time to time. you do this by calling:</p> <pre><code>[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound]; </code></pre></li> <li><p>after registering for remote notifications a method in your app delegate will be called which had been passed the token, you need to implement this method in your app delegate and send the token to your server (that will send you notifications). the method will look like this:</p> <pre><code>- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{ NSLog(@"device token is: %@",deviceToken); [server sendToken:deviceToken]; } </code></pre></li> </ol> <p>you should also implement this as well:</p> <pre><code> -(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{} </code></pre> <ol> <li><p>you need to handle notifications once you get them. there are few different scenarios in which you handle received notifications (the app is in the background or foreground etc.), the method that handles a notification if the app is in the foreground when you receive it should be implemented in the app delegate. this is it:</p> <pre><code>-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{ NSLog(@"received notification"); //handle the notification here } </code></pre></li> </ol> <p>to learn more about the userInfo structure and cover all the different scenarios read carefully <a href="http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html">http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html</a>. this was just the gist of things :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload