Tips for using the IOS SDK integration Guide
This article matches the SDK version: r1.2.5 later.
See recent updates for the latest SDK updates.
Product function Description
Aurora Push (Jpush) is an end-to-end push service that enables server-side messages to be pushed to end-user phones in a timely manner, allowing developers to actively stay connected to users, increasing user activity and increasing the retention rate of applications. Aurora Push Client supports Android, IOS two platforms.
The iOS SDK makes it easy for developers to quickly add push capabilities to iOS apps based on Jpush, reducing the amount of effort and development complexity required to integrate APNs.
Key Features
- Escalate device tokens for Jpush Server, eliminating the hassle of developers managing device tokens
- In-app Jpush long connection can receive push messages continuously while the app is running
Key Features
- Simple integration
- iOS SDK integration makes it easy to push server-side to iOS devices
Integrated Compressed Package Content
Package name is jpush-ios-sdk-[version number]
- Lib folder: Contains header file APService.h, static library file libpushsdk.a, supported iOS version 5.0 and later. (Please note: The simulator cannot implement APNs)
- PDF file: Development Guide
- Demo folder: Example
Development environment
- Running IOS8 version Sdk,xcode 5 running non-iOS 8 version SDK with XCode 6 version
SDK Integration Step 1, creating an app on Jpush portal
- Upload the certificate and create the app on the Jpush management portal. If you are not familiar with the APNs certificate, refer to the IOS Certificate Setup Guide
* The AppKey is automatically generated after the successful creation to identify the app.
2. Import API Development package to application project
- Unzip the SDK package, select "Add Files to ' Your project name ' ..." in Xcode and add the extracted Lib subfolders (including APService.h, LIBPUSHSDK.A) to your project directory.
3, the necessary framework
- Cfnetwork.framework
- Corefoundation.framework
- Coretelephony.framework
- Systemconfiguration.framework
- Coregraphics.framework
- Foundation.framework
- Uikit.framework
- Security.framework
- Libz.dylib
4. Build Settings
- Set the User Header search Paths and the Library search Paths under Search Paths, such as the SDK folder (the default is Lib) and the project file in the same level directory, are set to "$ (srcroot)/[folder name]" Can.
5. Create and configure the Pushconfig.plist file
Create a new property list file in your project and name it Pushconfig.plist, and fill in the App_key parameters provided by the portal for your app.
{ "aps_for_production " = " 0 "; "CHANNEL" = Publish Channel "; "App_key" = AppKey Copied from Jpush Portal application "; /span>
- CHANNEL
- Indicates the download channel of the application package for easy channel statistics. Define it according to your own needs.
- App_key
- Automatically generated when an app is created on the management portal (AppKey) to identify the app. Make sure that the AppKey in the in-app configuration is consistent with the AppKey generated when you create an app on the Portal in the 1th step, AppKey can be queried in the app details.
- Aps_for_production
- The 1.3.1 version is added to indicate whether the app is published with a production certificate (Ad_hoc or app Store), 0 (the default) is a developer certificate, and 1 is a production certificate publishing app.
- The values set here suggest setting values by corresponding certificates.
- In 1.2.2 or previous version of the configuration file, there is test_mode this key, the new version of the SDK is no longer used, you can delete it.
6. Add Code API
APIs are mainly concentrated in the Apservice interface class.
@interface Apservice : NSObjectInit Push+ (void)Setupwithoption:(Nsdictionary *)Launchingoption;Register notification type+ (void)Registerforremotenotificationtypes:(Uiremotenotificationtypetypes;//upload device token+ (voidregisterdevicetoken:( nsdata *) devicetoken//handle notification Recieved+ (void:(nsdictionary *) remoteinfo
Calling code
Listen for system events and invoke the API provided by the Jpush SDK to implement the functionality accordingly.
The following 3 events are required to listen and invoke the Jpush SDK API. Please directly copy the following code block, annotated "Required" line, to your application proxy class in the corresponding listening method.
- (BOOL)Application:(UIApplication *)Application Didfinishlaunchingwithoptions:(Nsdictionary *)Launchoptions{ Self.Window= [[[UIWindowAlloc]initWithFrame:[[UIScreenMainscreen]Bounds]]Autorelease]; Self.Window.BackgroundColor= [UicolorWhitecolor]; [Self.Window makekeyandvisible]; Required If ([[UideviceCurrentdevice].Systemversion Floatvalue] >= 8.0) { You can add a custom categories [ApserviceRegisterforremotenotificationtypes:(Uiusernotificationtypebadge | Uiusernotificationtypesound | Uiusernotificationtypealert)Categories:Nil]; } Else { The categories must be nil. [ApserviceRegisterforremotenotificationtypes:(Uiremotenotificationtypebadge | Uiremotenotificationtypesound | Uiremotenotificationtypealert)Categories:Nil]; } Required [ApserviceSetupwithoption:Launchoptions]; ReturnYES;}- (void)Application:(UIApplication *)Application Didregisterforremotenotificationswithdevicetoken:(NSData *)Devicetoken{ Required [ApserviceRegisterdevicetoken:Devicetoken];}- (void)Application:(UIApplication *)Application Didreceiveremotenotification:(Nsdictionary *)UserInfo{ Required [ApserviceHandleremotenotification:UserInfo];}- (void)Application:(UIApplication *)application didreceiveremotenotification:(nsdictionary< Span class= "PLN" > *) userinfo fetchcompletionhandler:(void (^) (uibackgroundfetchresult completionhandler { / /IOS 7 support Required [apservice Handleremotenotification:userinfo];uibackgroundfetchresultnewdata}
Monitoring notifications
The following 5 types of notifications are available in the API:
extern NSString * Const kjpfnetworkdidsetupnotification; Establish a connection
extern NSString * Const kjpfnetworkdidclosenotification; Close connection
extern NSString * Const kjpfnetworkdidregisternotification; Registration successful
extern NSString * Const kjpfnetworkdidloginnotification; Login successful
extern NSString * Const kjpfnetworkdidreceivemessagenotification; Receive Message (Non-APNS)
Where the kjpfnetworkdidreceivemessagenotification notification is transmitted data, can be obtained through the UserInfo method in Nsnotification, including title, content, content type, extended information, etc.
(reprint) IOS Aurora Push SDK Integration Guide