使用国际版的服务器,按照文档的描述
“
同时使用了推送服务和即时通讯服务的应用,客户端在成功登录即时通讯服务时,SDK 会自动关联当前的 clientId 和设备数据(推送服务中的 Installation 表)。关联的方式是通过让目标设备 订阅 名为 clientId 的 Channel 实现的。开发者可以在数据存储的 _Installation 表中的 channels 字段查到这组关联关系。在实际离线推送时,云端系统会根据用户 clientId 找到对应的关联设备进行推送。
”
SDK会自动关联 clientId和 deviceToken,但是实际上client登录后,在Installation表并没有自动关联,当前该功能SDK是否还存在,是否是需要Client自动调用接口去维护关联关系,另外关于其他的conversation如何实现push,文档中没有相关描述,是否需要手动注册conversation?
其他关于配置的数据是正确的,在控制台在线推送,功能正常,望回复
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { registry in
GeneratedPluginRegistrant.register(with: registry)
}
do {
LCApplication.logLevel = .all
try LCApplication.default.set(
id:
key:
serverURL: "https://tjqc91rv.api.lncldglobal.com"
)
GeneratedPluginRegistrant.register(with: self)
/*
register APNs to access token, like this:
*/
UNUserNotificationCenter.current().getNotificationSettings { settings in
switch settings.authorizationStatus {
case .authorized:
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
case .notDetermined:
UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .alert, .sound]) { granted, _ in
if granted {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
default:
break
}
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} catch {
fatalError("\(error)")
}
}
override func application(_: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
/*
set APNs deviceToken and Team ID.
*/
LCApplication.default.currentInstallation.set(
deviceToken: deviceToken,
apnsTeamId:
)
/*
save to LeanCloud.
*/
LCApplication.default.currentInstallation.save { result in
switch result {
case .success:
break
case let .failure(error: error):
print(error)
}
}
}
override func application(_: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
print(error)
}
override func applicationDidBecomeActive(_ application: UIApplication) {
// empty badge
application.applicationIconBadgeNumber = 0
// currentInstallation bage to zero
LCApplication.default.currentInstallation.badge = 0
LCApplication.default.currentInstallation.save { result in
switch result {
case .success:
break
case let .failure(error: error):
print(error)
}
}
}
}