将环信的SDK和UI导入到项目中,编译以及运行正常,遇到的问题时在代码中引用遇到的问题

1.在AppDelegate中执行

[EaseMob sharedInstance]崩溃

解决方案:other link flags添加“-ObjC”选项(注意:O和C大写)

2.消息提示的小红点问题。在

UITabBarController的子类中

设置了

IChatManagerDelegate,但是

setupUnreadMessageCount不回

原因:在AppDelegate中没有写

- (void)applicationWillResignActive:(UIApplication *)application {

    [[EaseMob sharedInstance] applicationWillResignActive:application];

 }

- (void)applicationDidEnterBackground:(UIApplication *)application {

    [[EaseMob sharedInstance] applicationDidEnterBackground:application];

}

 - (void)applicationWillEnterForeground:(UIApplication *)application {

    [[EaseMob sharedInstance] applicationWillEnterForeground:application];

}

 - (void)applicationDidBecomeActive:(UIApplication *)application {

    [[EaseMob sharedInstance] applicationDidBecomeActive:application];

}

 - (void)applicationWillTerminate:(UIApplication *)application {

    [[EaseMob sharedInstance] applicationWillTerminate:application];

}

 将以上几个方法在AppDelegate中写上后,就能正常回调

 问题二:往环信后台设置证书后,同时在代码里将证书名称设置一致,但是还是收不到推送消息,并有如下错误信息:

解决方案,在配置文件里,将Background Modes打开,勾选“Remote notifications”,后就能正常收到推送消息

问题三:

用户登录后,第一次登陆获取不到聊天记录(在本地已有聊天记录数据库的前提下),以后能获取到

    [[EaseMob sharedInstance].chatManager setIsAutoLoginEnabled:YES];

    [[EaseMob sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];//该行代码一定要放在setIsAutoLoginEnabled,否则会造成加载不到聊天记录的bug

问题四:

点开聊天界面,不聊天时,聊天列表也会有该条聊天记录,也就是说,空记录也会加入到聊天列表中

解决方案:

[[EaseMob sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];

[MagicalRecord setupCoreDataStackWithStoreNamed:[NSString stringWithFormat:@"%@.sqlite", @"YRCoreData"]];

posted on 2015-01-19 15:01  瓜甜甜  阅读(5024)  评论(0编辑  收藏  举报