Skip to main content

Add JPush on iOS

Use the AppKey assigned by NextAppMarket and the APNs configuration agreed for your app. This guide shows Objective-C integration points; use the equivalent interfaces exposed by your pinned SDK in a Swift project.

1. Prepare the target​

Install the selected JPush release, enable the Push Notifications capability, and check that your signing and provisioning include the correct APNs entitlement. Keep the bundle ID consistent with the NextAppMarket handoff.

With CocoaPods, pin the version you have selected:

pod 'JPush', ENV.fetch('JPUSH_SDK_VERSION')

Set that environment value before pod install and commit the resulting lockfile. Confirm the selected JCore dependency and SDK deployment requirements for your project.

2. Initialize the service​

After your app's required consent, initialize using the assigned AppKey and the APNs environment of the signed build:

#import "JPUSHService.h"

[JPUSHService setupWithOption:launchOptions
appKey:jpushAppKey
channel:@"app-store"
apsForProduction:usesProductionAPNs];

launchOptions, jpushAppKey, and usesProductionAPNs come from your app lifecycle and build configuration. Preserve launch context if initialization is deferred until consent.

3. Register notifications and the device token​

Configure JPUSHRegisterEntity for the notification types your product uses, register a JPUSHRegisterDelegate, and handle the permission result. When APNs registration succeeds, pass the device token to JPush:

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[JPUSHService registerDeviceToken:deviceToken];
}

Implement the SDK's notification delegate callbacks, report remote notifications through handleRemoteNotification:, and call each system completion handler. Define foreground presentation explicitly.

4. Send to one installation​

Obtain the JPush Registration ID after registration succeeds. Use it in your first notification, with apns_production matching this build. APNs device tokens and JPush Registration IDs are different identifiers; the REST example targets the latter.

Verify the experience​

Test on a signed device with permission allowed, permission denied, the app in the background, and a notification opened after launch. For a missing notification, compare the APNs entitlement, sender option, AppKey, bundle, and token-registration path before resending.

References: iOS integration and iOS SDK API.