Tutorial by Examples

To register your device for push notifications, add the following code to your AppDelegate file in didFinishLaunchingWithOptions method: Swift func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for c...
Swift let isPushEnabled = UIApplication.sharedApplication().isRegisteredForRemoteNotifications()
The logic of registering for push notification is recommended to be added in AppDelegate.swift as the callback functions (success, failure) will be called their. To register just do the following: let application = UIApplication.sharedApplication() let settings = UIUserNotificationSettings(forType...
Once user clicks on a push notification, the following callback function will be called. You can parse the JSON to get any specific info sent from backend that will helps you in deep linking: Swift func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : ...
Things you need A paid Apple Developer Program Membership A valid App ID and identifier for you app (like com.example.MyApp) which is not used before anywhere Access to developer.apple.com and Member Center An iOS Device to test (as Push Notifications don't work on Simulator) Enabling t...
To unregister from Remote Notifications programatically you can use Objective-C [[UIApplication sharedApplication] unregisterForRemoteNotifications]; Swift UIApplication.sharedApplication().unregisterForRemoteNotifications() this is similar to going into the setting of your phone and manual...
Use the following piece of code to set the badge number from within your application (suppose someNumber has been declared before): Objective-C [UIApplication sharedApplication].applicationIconBadgeNumber = someNumber; Swift UIApplication.shared.applicationIconBadgeNumber = someNumber In order ...
It is always a good practice to test how push notifications work even before you have your server side ready for them, just to make sure that everything is set up correctly on your side. It is quite easy to send yourself a push notification using a following PHP script. Save the script as a file ...
Save aps.cer to a folder Open "Keychain access" and export the key that is under that certificate to a .p12 file (call it key.p12). To do that right click on it and choose Export. Save it to the same folder as step 1. On export you will be prompted for a password. Make something u...

Page 1 of 1