锁屏时的效果 | 在后台时的效果 |
| |
target 'YourAppName' do# Uncommment the next line if you're using Swift or would like to use dynamic frameworksuse_frameworks!use_modular_headers!# Pods for Examplepod 'TIMPush', '7.9.5668'end
pod install # 如果无法安装 TUIKit 最新版本,执行以下命令更新本地的 CocoaPods 仓库列表。 pod repo update
Push Notification
的 Service
。Bundle ID
不能使用通配符 *,否则将无法使用远程推送服务。Bundle ID
等其他信息,单击 Continue 进行下一步。SSL Certificate
,分别用于开发环境(Development)和生产环境(Production)的远程推送证书。Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority
)。*.certSigningRequest
文件。*.certSigningRequest
文件。Development SSL Certificate
到本地。Production SSL Certificate
下载到本地。Sandbox
)+生产(Production
)的合并证书,可以同时作为开发环境和生产环境的证书使用。SSL Certificate
,系统会将其导入钥匙串中。Apple Development IOS Push Service
)和生产环境(Apple Push Services
)的 P12 文件。P12
文件时,请务必要为其设置密码。offlinePushCertificateID
协议方法返回证书 ID 即可。import TIMPushfunc offlinePushCertificateID() -> Int32 {return kAPNSBusiId}
#pragma mark - TIMPush- (int)offlinePushCertificateID {return kAPNSBusiId;}
import TUICallKit_Swiftimport TUICallEnginelet pushInfo: TUIOfflinePushInfo = TUIOfflinePushInfo()pushInfo.title = ""pushInfo.desc = "您有一个新的通话"pushInfo.iOSPushType = .apnspushInfo.ignoreIOSBadge = falsepushInfo.iOSSound = "phone_ringing.mp3"pushInfo.androidSound = "phone_ringing"// OPPO必须设置ChannelID才可以收到推送消息,这个channelID需要和控制台一致// 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 = pushInfo// 仅以单人通话举例、群通话类似TUICallKit.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 = @"您有一个新的通话";pushInfo.iOSPushType = TUICallIOSOfflinePushTypeAPNs;pushInfo.ignoreIOSBadge = NO;pushInfo.iOSSound = @"phone_ringing.mp3";pushInfo.AndroidSound = @"phone_ringing";// OPPO必须设置ChannelID才可以收到推送消息,这个channelID需要和控制台一致// 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:
回调返回的是发布环境的 token,此时 businessID 需要设置生产环境的证书 ID。- application:didRegisterForRemoteNotificationsWithDeviceToken:
回调返回的是开发环境的 token,此时 businessID 需要设置开发环境的证书 ID。
本页内容是否解决了您的问题?