IOS Aurora Push

Source: Internet
Author: User

1. A few certificates for push. Http://www.mobile-open.com/2016/931624.html into the developer Center: Https://developer.apple.com/account/ios/identifier/bundle, (1) Create the APP ID and skip this step if the ID already exists. Turn on the Push Notification feature for your App. If you have already created an App ID, you can also turn on the Push Notification feature by setting it up.

According to the actual situation to improve the APP ID information and submit, note here need to specify the specific Bundle ID do not use wildcard characters. (2) New certificate needs to be careful to select the type of certificate (development certificate for development and debugging use, production certificate for the APP Store release)

Click Continue to select the app ID for the certificate, and then continue with "about Creating a Certificate Signing Request (CSR)."

Create a Certificate Signing request by creating an open keychainaccess according to its instructions

Continue back to Apple Developer website Click Continue to upload the. certsigningrequest file you just generated APNs Push Certificate. Download and double-click the open certificate, which launches the Keychain Access tool when the certificate is opened.

Right-click the certificate you just generated, export the P12 file (a total of 2 P12 files, the same as the export step). Attention: 导出证书时要选中证书文件,不要展开private key

(3) Creation of Provisioning profileThe premise of creating a provisioning profile is to create an app ID for the bundle ID used by the app to be published on the Apple Developer website, and to create a APNS certificate for that app ID, such as:On the Provisioning profile page of the Apple Developer account, click the button to create the provisioning profile

Double-click the downloaded provisioning profile and add it to Xcode. So far, certificate creation is complete. 1. Enter the Aurora website, register, log in, and create a new application: https://www.jiguang.cn/

The application creation is complete here. (4) configuration items: (1) Allow Xcode7 to support HTTP transfer methodsIf you are using a later version of 2.1.9, you do not need to configure this step if you are using Xcode7 or later, you need to manually configure the key and value in the plist of the app project to support HTTP transmission.

Global configuration

  <key>NSAppTransportSecurity</key> 
  <dict> 
    <key>NSAllowsArbitraryLoads</key> 
    <true/> 
  </dict
(2) Configure the certificate and turn on background push

to open remote notifications, you need to modify the app's capabilities in Xcode to open remote notifications

3.SDK Integration Steps (refer to Official document:http://docs.jiguang.cn/jpush/client/iOS/ios_guide_new/ ) Here is the code section

Import header file #import "JPUSHService.h" in APPDELEGATE.M

Write the following code in the Didfinishlaunchingwithoptions method, where you want to fill in your own information

1 //Required2 if([[Uidevice currentdevice].systemversion Floatvalue] >=8.0) {3     //You can add a custom categories4[Jpushservice registerforremotenotificationtypes: (Uiusernotificationtypebadge | Uiusernotificationtypesound |Uiusernotificationtypealert) Categories:nil];5}Else {6     //the categories must be nil .7[Jpushservice registerforremotenotificationtypes: (Uiremotenotificationtypebadge | Uiremotenotificationtypesound |Uiremotenotificationtypealert) Categories:nil];8 }9 Ten[Jpushservice setupwithoption:launchoptions AppKey: Your AppKey (string), which can be seen in the application details of the Aurora"channel:@""(This does not fill the line) Apsforproduction: This value production environment is yes, the development environment is no (bool value)]; One  A   -  - Create the  --(void) Application: (UIApplication *) application Didregisterforremotenotificationswithdevicetoken: (NSData *) Devicetoken -  -  + method to register the device (remove this) -  +- (void) Application: (UIApplication *) application Didregisterforremotenotificationswithdevicetoken: (NSData *) Devicetoken { A     //This method is to set the alias and tag to save at     //[Jpushservice settags:nil alias:@ "Wzxjiang" fetchcompletionhandle:^ (int irescode, Nsset *itags, NSString *iAlias) {  -     //NSLog (@ "Rescode:%d, \ntags:%@, \nalias:%@\n", Irescode, Itags, Ialias); -     //   }]; -     //Required - [Jpushservice Registerdevicetoken:devicetoken]; - } in  -   to  + Create -  the- (void) Application: (UIApplication *) application didreceiveremotenotification: (nsdictionary *) userInfo Fetchcompletionhandler: (void(^) (Uibackgroundfetchresult)) Completionhandler: *  $ Panax Notoginseng When the app receives push processing while in the background -  the- (void) Application: (UIApplication *) application didreceiveremotenotification: (nsdictionary *) userInfo Fetchcompletionhandler: (void(^) (Uibackgroundfetchresult)) Completionhandler { +     //IOS 7 and later, no one is fit for iOS6 now ... A     //IOS 7 Support Required the [Jpushservice Handleremotenotification:userinfo]; + Completionhandler (uibackgroundfetchresultnewdata); - } $  $   -  - clear the red dot in the Applicationwillenterforeground method (app is about to enter the foreground) the  -- (void) Applicationwillenterforeground: (UIApplication *) Application {WuyiNSLog (@"Access to reception"); the[UIApplication Sharedapplication].applicationiconbadgenumber =0; - } Wu  About  $ Create -  - Didfailtoregisterforremotenotificationswitherror -  A  + method to handle a situation where a push error is received (generally not ...) the- (void) Application: (UIApplication *) application Didfailtoregisterforremotenotificationswitherror: (NSError *) Error { -     //Optional $NSLog (@"Did Fail to Register for Remote notifications with Error:%@", error); the}
4. Test Push results:

Note that to run on a real machine, if you can receive your own push messages, the Aurora integration is done. 1. Issue: Resolve: Double-click the certificate:

2. The application in the foreground is not receiving the message, there is no red dot hint, the application in the background or kill the situation is normal to receive the message. It is said that after iOS 10 does not have this problem, but currently because the project problem has not been IOS10 adaptation, hope to solve this problem, for the integration of Aurora push problem small partners can be proposed to discuss together and progress together.

IOS 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.