Xcode7写的所有RN项目,在升级到Xcode8都会报错,需要做以下修改。
1、RCTSRWebSocket.m

将报错行修改成:
int result = SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
assert(result == 0);```
上面是我对照Xcode8新建的可用项目代码做的修改,有人提供以下解决方法:
(void)SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
已试,都可解决报错问题。
##2、RCTScrollView.m

打开RCTSCrollView.m **Command+F 搜索@implementation RCTCustomScrollView**
只会搜索到一个结果,然后修改:
@implementation RCTCustomScrollView
{
RCTRefreshControl *_refreshControl;//不管原来有什么,在原来的基础上加上这句
}```
3、 Team && Code signing(推荐方法)

选择Team: General--Signing--Team--选择一个可用的Team
注:我在这里选择的是Automatically manage singing,如果你手动配置的话,保证Provisioning Profile可用并匹配即可。

运行后还是显示这个错误,需要注意,Targets有两个,两个都要设置Team

3.1 网上其他解决方法(可尝试方法)
方法一:
Build Setting--Code Signing Identity--将Don't Code Sign改成iOS Developer或者iOS Distribution
使用手动配置Provisioning Profile时,我使用该方法,还是报错。stackoverflow上有人说自己通过这个方式解决了问题,对于这个方法是否有效,不予置评。

方法二:
把红色箭头指向的那一行 全部取消选中 即可,已测,项目不再报错。
个人感觉该方法不太靠谱,Xcode8新建的项目中也是默认选中这几项的,这几项选中是有它的道理,这个方法没有从根本上解决问题。

综上,建议大家使用推荐的解决方法
网友评论