Lock Screen Effects | Effects When in the Background |
| |
Push Notification
Service
to your existing AppID.Bundle ID
of your App cannot use the wildcard *, otherwise the remote push service cannot be used.SSL Certificates
in the Apple Push Notification service SSL Certificates window, which are used for the remote push certificates of the development
environment and production environment, as shown in the picture below:*.certSigningRequest
file.*.certSigningRequest
file. Development SSL Certificate
locally.Production SSL Certificate
for the production environment.SSL Certificates
, and the system will import them into the keychain.P12
file, please be sure to set a password for it.import ImSDK_Plusfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error inif let error = error {print("Error requesting authorization for notifications: \\(error)")return}// Request DeviceToken from Apple backendDispatchQueue.main.async {application.registerForRemoteNotifications()}}return true}// The deviceToken will be returned in the AppDelegate's callback, and needs to be reported to the Tencent Cloud backend after logging infunc application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {// Record the deviceToken returned by AppletuiDeviceToken = deviceToken}
#import <UserNotifications/UserNotifications.h>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge)completionHandler:^(BOOL granted, NSError * _Nullable error) {if (error) {NSLog(@"Error requesting authorization for notifications: %@", error);return;}// Request DeviceToken from Apple backenddispatch_async(dispatch_get_main_queue(), ^{[application registerForRemoteNotifications];});}];return YES;}// The deviceToken will be returned in the AppDelegate's callback, and needs to be reported to the Tencent Cloud backend after logging in-(void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {// Record the deviceToken returned by Apple_deviceToken = deviceToken;}
import ImSDK_Plusfunc pushRegisterIfLogin() {let config = V2TIMAPNSConfig()// Users register for a Developer Certificate with Apple themselves, download and generate the certificate (P12 file) in their developer accounts, and upload the generated P12 file to the Tencent Certificate Management Console,// The console will automatically generate a certificate ID, which should be passed into the following `businessID` parameter.config.businessID = 1234;// DeviceToken obtained from the Apple backend serverconfig.token = tuiDeviceToken;V2TIMManager.sharedInstance().setAPNS(config) {} fail: { code, msg in}}
#import <ImSDK_Plus/ImSDK_Plus.h>- (void)pushRegisterIfLogin {V2TIMAPNSConfig *config = [[V2TIMAPNSConfig alloc] init];// Users register for a Developer Certificate with Apple themselves, download and generate the certificate (P12 file) in their developer accounts, and upload the generated P12 file to the Tencent Certificate Management Console,// The console will automatically generate a certificate ID, which should be passed into the following `businessID` parameter.config.businessID = 1234;// DeviceToken obtained from the Apple backend serverconfig.token = _deviceToken;[[V2TIMManager sharedInstance] setAPNS:config succ:^{} fail:^(int code, NSString *msg) {}];}
import TUICallKit_Swiftimport TUICallEnginelet pushInfo: TUIOfflinePushInfo = TUIOfflinePushInfo()pushInfo.title = ""pushInfo.desc = "You have a new call"pushInfo.iOSPushType = .apnspushInfo.ignoreIOSBadge = falsepushInfo.iOSSound = "phone_ringing.mp3"pushInfo.androidSound = "phone_ringing"// For OPPO, you must set the `ChannelID` to receive push messages. The `ChannelID` must be identical with that in the console.// OPPO must set a ChannelID to receive push messages. This channelID needs to be the same as the console.pushInfo.androidOPPOChannelID = "tuikit"// FCM channel ID, you need change PrivateConstants.java and set "fcmPushChannelId"pushInfo.androidFCMChannelID = "fcm_push_channel"// VIVO message type: 0-push message, 1-System message(have a higher delivery rate)pushInfo.androidVIVOClassification = 1// HuaWei message type: https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/message-classification-0000001149358835pushInfo.androidHuaWeiCategory = "IM"let params = TUICallParams()params.userData = "User Data"params.timeout = 30params.offlinePushInfo = pushInfoTUICallKit.createInstance().call(userId: "123456", callMediaType: .audio, params: params) {} fail: { code, message in}
#import <TUICallKit_Swift/TUICallKit_Swift-Swift.h>#import <TUICallEngine/TUICallEngine.h>- (TUICallParams *)getCallParams {TUIOfflinePushInfo *offlinePushInfo = [self createOfflinePushInfo];TUICallParams *callParams = [TUICallParams new];callParams.offlinePushInfo = offlinePushInfo;callParams.timeout = 30;return callParams;}- (TUIOfflinePushInfo *)createOfflinePushInfo {TUIOfflinePushInfo *pushInfo = [TUIOfflinePushInfo new];pushInfo.title = @"";pushInfo.desc = @"You have a new call";pushInfo.iOSPushType = TUICallIOSOfflinePushTypeAPNs;pushInfo.ignoreIOSBadge = NO;pushInfo.iOSSound = @"phone_ringing.mp3";pushInfo.AndroidSound = @"phone_ringing";// OPPO must set a ChannelID to receive push messages. This channelID needs to be the same as the console.pushInfo.AndroidOPPOChannelID = @"tuikit";// FCM channel ID, you need change PrivateConstants.java and set "fcmPushChannelId"pushInfo.AndroidFCMChannelID = @"fcm_push_channel";// VIVO message type: 0-push message, 1-System message(have a higher delivery rate)pushInfo.AndroidVIVOClassification = 1;// HuaWei message type: https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/message-classification-0000001149358835pushInfo.AndroidHuaWeiCategory = @"IM";return pushInfo;}[[TUICallKit createInstance] callWithUserId:@"123456"callMediaType:TUICallMediaTypeAudioparams:[self getCallParams] succ:^{} fail:^(int code, NSString * _Nullable errMsg) {}];
- application:didRegisterForRemoteNotificationsWithDeviceToken:
callback returns the production environment token. In this case, the businessID needs to be set to the production environment Certificate ID.- application:didRegisterForRemoteNotificationsWithDeviceToken:
callback returns the development environment token. In this case, the businessID needs to be set to the development environment certificate ID.
Was this page helpful?