To perform the following operations, you must apply for a certificate successfully

Mac Keystring -- "Keystring access --" Certificate Assistant -- "request certificate from ca --" generate CSR file (certificate password is the password used when aurora pushes and uploads the certificate)# # # # # # [developer] (https://developer.apple.com/account) website
Copy the code

Create a certificate in #Bundle ID– (in #Bundle ID, check #Push Notifications) Export as. P12 file in keystring upload development certificate or publish certificate when aurora registration application — “complete registration # description file has problems can be generated description file (the main function is to establish association between application and AppID, certificate)

####1. Import the static library
Copy the code

After the downloaded Aurora push SDK package is decompressed, drag the Lib file into the project, and then import the related static library

Download the SDK and import the two required files into the project:! [jpushsdk.png](http://upload-images.jianshu.io/upload_images/1398091-12278e5fe027de26.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240) H header file and static library file jpush-ios-x.x.x.a. The ios version 5.0 or later is supported. // (please note: the emulator does not support APNs) PDF file: Integration guide Demo folder: Examples! [static library.png](http://upload-images.jianshu.io/upload_images/1398091-ec2a7be673e7b73a.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)####2. Code configuration
Copy the code

#import “jpushservice.h” #import <AdSupport/ adsupport.h >

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSString *advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; //Required if ([[UIDevice currentDevice].SystemVersion floatValue] >= 8.0) {// Custom categories [JPUSHService can be added registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]; } else {/ / categories must be nil [JPUSHService registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert) categories:nil]; } / / Required. / / if you want to continue to use pushConfig file statement appKey configuration such as the content, please still use [JPUSHService setupWithOption: launchOptions] way to initialize. [JPUSHService setupWithOption: launchOptions appKey: appKey channel: the channel / / publishing platform, Nil apsForProduction: isProduction / / a Boolean value advertisingIdentifier: advertisingId]; }

  • (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

    / / / Required – registered DeviceToken [JPUSHService registerDeviceToken: DeviceToken]; }

  • (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

    // Required,For systems with less than or equal to iOS6 [JPUSHService handleRemoteNotification:userInfo]; }

  • (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {

    // IOS 7 Support Required [JPUSHService handleRemoteNotification:userInfo]; completionHandler(UIBackgroundFetchResultNewData); // The application is processing the foreground state and will not receive a push message. So here need to additional processing if (application. ApplicationState = = UIApplicationStateActive) {UIAlertView * alert = [[UIAlertView alloc] Message :userInfo[@”aps”][@”alert”] delegate:nil cancelButtonTitle:@” cancel” OtherButtonTitles: @ “sure,” nil]; [alert show]; }}

  • (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { //Optional NSLog(@”did Fail To Register For Remote Notifications With Error: %@”, error); }

  • (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. [application setApplicationIconBadgeNumber:0]; return; }

# # # # 3. Xcode Settings
Copy the code

If your project needs to support iOS systems smaller than 7.0, please go to Build Settings and turn off the bitCode option, otherwise it will not compile properly

! [http.png](http://upload-images.jianshu.io/upload_images/1398091-cc865ecb4b955c74.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)Copy the code

Set to allow push

! [Xcode.png](http://upload-images.jianshu.io/upload_images/1398091-4fd31e5a3d963070.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)####4. Xcode will print the following:! [Print result.png](http://upload-images.jianshu.io/upload_images/1398091-000cfcde468a26dd.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)####5. Send test information on the official website of Aurora push. During the test, the application will exit from the real computer and run in the background! [test information.png](http://upload-images.jianshu.io/upload_images/1398091-de080b866100bc90.png? ImageMogr2 / auto - received/strip % 7 cimageview2/2 / w / 1240) data: Custom categories [push] (http://my.oschina.net/u/1418722/blog/317422) [iOS development in remote push implementation (the latest, Support iOS9)] (HTTP: / / https://zm10.sm-tc.cn/?src=http%3A%2F%2Fwww.mamicode.com%2Finfo-detail-1124741.html&uid=48a54dfb9031a7654198c53 9e9001d2f&hid=55b226f6266805a848e1c24be8b9cddd&pos=1&cid=9&time=1466556151388&from=click&restype=1&pagetype=000000400000 0402 & bu = structure_web_info & query = ios9) [iOS: aurora push] (http://www.cnblogs.com/XYQ-208910/p/5463802.html)Copy the code