5.环信3.3.2(一些常见配置问题)
2018-01-24 本文已影响144人
淡闲星草
注意
本文是在 环信官方demo上直接更改的,并非重新导入环信sdk
错误1
真机定位 错误: 点击 聊天框 获取定位 的时候 崩溃

Log:
2017-07-01 15:53:34.406824+0800 ChatDemo-UI3.0[3016:1192215] libMobileGestalt MobileGestaltSupport.m:153: pid 3016 (ChatDemo-UI3.0) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-07-01 15:53:34.406913+0800 ChatDemo-UI3.0[3016:1192215] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)

解决方案
1.在环信 的定位界面 EaseLocationViewController.h
中添加如下 一个 region 代码
//此处 经纬度(CLLocationCoordinate2D) 最好 写一个 国内 经纬度
CLLocationCoordinate2D startCoord = CLLocationCoordinate2DMake(35.3, 113.9);
[_mapView setRegion:MKCoordinateRegionMakeWithDistance(startCoord, 200.0, 200.0) animated:YES];

错误2.
国际化 模拟器 显示 英文 问题,(真机 显示 为 中文),强制 设置成 中文 显示
解决方案

将 相应的 2 个 plist 中 的 Localization native development region 属性 改成 zh-Hans
zh-Hans ------------ > ( 简体中文)
en ------------ > ( 英文)
错误3
可以正常编译,但是打包ipa 报错
原因
环信 不支持 bitcode 模式
解决方案
将 有关 bitcode 改成 NO
最好将 project 以及 targets 里面的 全部改成 NO

错误 4
与 极光推送 配置 ,极光 推送获取不到 token,无法 推送
原因
环信 与 极光 的部分 冲突,环信 重写了 如下方法
不运行如下方法

解决方案
1\. appdelegate.m 中 极光的 配置、 相关导入的 类库、info.plist 的配置 极光设置 不更改,
2.在 AppDelegate+EaseMob.m 中 引入 极光 头 文件 #import "JPUSHService.h"
在如下方法中 注册 deviceToken
注意 有可能 极光 与 环信的 版本 问题,相关的注册 deviceToken 的具体 代码有所 差异,(此处 极光 3.0.5 环信3.3.2)
// 将得到的deviceToken传给SDK
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[EMClient sharedClient] bindDeviceToken:deviceToken];
[JPUSHService registerDeviceToken:deviceToken];
});
}

错误5
更改 登录 逻辑后 偶尔黑屏、闪屏,甚至 加载 白版 显示不出页面
原因
更改 环信 官方 demo 后, 有可能 重写 多次 window 的初始化方法

解决方法
如上 红框 方法 办证在 Appdelegate.m中 只 初始化 了 一次
错误6
有关环信 证书 的配置
1.由于 环信 没有 使用 pch 全局的 宏定义,所以要 一处 一处 的改
全局 搜索 apnsCertName
将相应 自己注册的环信 账号 配置 的证书 名 ,更改。
注意 options.apnsCertName = @""; 中使用的 为 测试 证书名字(参考 官方demo )



错误8
环信 key 的更改

#define EaseMobAppKey @"XXXXX#XXXXcollection"
1.将 Appdelegate.m 中的 EaseMobAppKey 替换成 自己的key
错误9
tabbarItem 图标蓝色 问题,与 给定的 原图 红色 不否和 问题

//错误 代码
meVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的"
image:[UIImage imageNamed:@"MainVC_me_normal"]
selectedImage:[UIImage imageNamed:@"MainVC_me_selected"]];
//正确代码 -- 添加图片 原型 的 设置
meVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的"
image:[[UIImage imageNamed:@"MainVC_me_normal"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
selectedImage:[[UIImage imageNamed:@"MainVC_me_selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
错误10
导航栏 颜色 设置
1.在Appdelegate.m 设置如下代码
