iOS Integrated Aurora push

Source: Internet
Author: User

iOS Integrated Aurora push

First, configure the APNs

Apple APNs (English name: Apple Push Notification Service)

1. Configure the development certificate


! [Uploading apns_13_803165.png ...]

2. Configure the production certificate

The same process as configuring the development certificate.

3. Export the configured certificate as a. p12 file

First, registered Aurora push account

You can log in to the Aurora push website to register your account.

Enter the console after successful registration

Second, integrated Aurora Push SDK

SDK Address

I'm using the jpush-ios-sdk-2.1.0. The downloaded file has a PDF file Ios+sdk+integration+guide.pdf, which describes the detailed code for integrated Aurora push.

In the project file, make the following settings:

! [Uploading apns_18_876090.png ...]

Here is the code I wrote:

APPDELEGATE.M file

- (BOOL) Application: (uiapplication*) Application Didfinishlaunchingwithoptions: (nsdictionary*) Launchoptions {//Set Appkey[Jpushconfig registerjpush:launchoptions];return YES;}#pragma mark to modify the notification handler function-(void) Application: (uiapplication*) Application Didreceiveremotenotification: (nsdictionary*) UserInfo Fetchcompletionhandler: (nonnullvoid(^) (Uibackgroundfetchresult)) Completionhandler {//Push message carrying content-available:1 is a must-have parameter for the background to run, which is the same as the normal push of a previous version of IOS7 if you do not carry this field.     //Clear the corner mark[Jpushservice Resetbadge];if(!userinfo) {Completionhandler (uibackgroundfetchresultnodata);return; } completionhandler (Uibackgroundfetchresultnewdata);//Based on the userInfo format of the server settings, parse}//Required-(void) Application: (uiapplication*) Application Didregisterforremotenotificationswithdevicetoken: (NSData *) Devicetoken {[JPUSHService Registerdevicetoken:devicetoken];}//Required-(void) Application: (uiapplication*) Application Didreceiveremotenotification: (nsdictionary*) UserInfo {[Jpushservice handleremotenotification:userinfo]; Application. Applicationiconbadgenumber=0;} - (void) Application: (uiapplication*) Applicationdidreceivelocalnotification: (uilocalnotification*) Notification {[Jpushservice showlocalnotificationatfront:notification Identifierkey:Nil];} -(void) Application: (uiapplication*) Application Didfailtoregisterforremotenotificationswitherror: (Nserror*) Error {}-(void) Applicationdidbecomeactive: (uiapplication*) application {[Application Setapplicationiconbadgenumber:0];}

JPUSHCONFIG.M file

/** Register Jpush * /+(void) Registerjpush: (Nsdictionary *) launchoptions {//Required    if([[Uidevice currentdevice].systemversion Floatvalue] >=8.0) {//You can add a custom categories[Jpushservice registerforremotenotificationtypes: (Uiusernotificationtypebadge |                                                          Uiusernotificationtypesound |    Uiusernotificationtypealert) Categories:nil]; }Else{The//categories must be nil .[Jpushservice registerforremotenotificationtypes: (Uiusernotificationtypebadge |                                                          Uiusernotificationtypebadge |    Uiusernotificationtypebadge) Categories:nil]; } nsstring *appkey = @"Aurora push generated key"; NSString *channel = @"App Store";//distribution channels, can be arbitrarily definedBOOL isproduction =false;//This is based on the Aurora push the console is set in the development environment or production environment    //required[Jpushservice setupwithoption:launchoptions Appkey:appkey Channel:chann El apsforproduction:isproduction];}

After you receive the notification message, in APPDELEGATE.M jump to the specified interface method:

    UIViewController *vc = [[UIViewController alloc] init];    [self.window.rootViewController presentViewController:vc animated:YES completion:nil];

iOS Integrated Aurora push

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.