AVCloud iOS SDK版本 3.1.2.6
经过测试发现openWithClientId:callback:
回调成功之后打印currentInstallation
的话看到有channels里有新的clientId存在,但是在lean后台Installation
表里看到的是并未更新。
而在调用closeWithCallback
回调成功之后打印的和lean后台Installation
表里的都是被成功更新成[]
我是在测试切换用户(close成功之后立即open新的)的时候必然发生此情况。其他方式没测试,不知道是否有影响。
我本身是想既然SDK里并没有去更新成功。那我就自己去在openWithClientId:callback:
回调里调用更新AVInstallation方法去更新,很遗憾依然更新不成功,甚至我延迟1秒去更新还是不行。
最终channel还是在下面这里才被真正更新到lean。
- (void)applicationDidEnterBackground:(UIApplication *)application
{
AVInstallation *currentInstallation = [AVInstallation currentInstallation];
[currentInstallation setBadge:[UIApplication sharedApplication].applicationIconBadgeNumber];
//这里最好是用UIBackgroundTaskIdentifier
if([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]){
__block UIBackgroundTaskIdentifier background_task;
background_task = [application beginBackgroundTaskWithExpirationHandler:^ {
[application endBackgroundTask:background_task];
background_task = UIBackgroundTaskInvalid;
}];
[currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded) {
DLOG(@"修改badge到后端完毕1");
}
[application endBackgroundTask:background_task];
background_task = UIBackgroundTaskInvalid;
}];
}else{
[currentInstallation save];
DLOG(@"修改badge到后端");
}
}
这个就比较尴尬,这时候可能更新channel已经是在新消息到来需要推送之后了。虽然这情况比较极端,但是这就会丢失消息了。
我想这应该是SDK的BUG,open连接之后至少得保证channel被更新到lean。
-
创建时间
15年7月10日
-
最后回复
15年7月18日
-
1
回复
-
903
浏览
-
1
用户