Does anyone have problem building React Native on the Xcode 8.0 beta?
Yeah same Problem
Same Problem +1
Yep. In iOS 10, SecRandomCopyBytes has a new attribute
attribute ((warn_unused_result)).
How should we handle this? Has anyone had luck building for iOS10? I saw @vjeux's tweet here and was hoping that change was the only one needed.
Not sure if this is the right fix but I was able to get around this by casting SecRandomCopyBytes as void:
(void)SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
(void)SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
This + what nickstamas linked was enough to get it to build and deploy on ios10.
@mskalra With the combination of the changes to RCTScrollView and RCTSRWebSocket, I can get an app to build, but I'm seeing a lot of console output like this:
nw_endpoint_flow_protocol_disconnected [1.1 ::1.8081 cancelled socket-flow (null)] Output protocol disconnected
There's other weirdness too. I have to run the packager manually, it doesn't run automatically when I hit Play in Xcode. Also, the app seems unresponsive in the Simulator.
@nickstamas strange, it seems to build and deploy like normal for me, both on my device and in the simulator.
Will probably have to wait for an official fix.. Shouldn't be too long hopefully. Good luck!
Wrapping SecRandomCopyBytes()
with a call to assert(0 == ...)
is probably a marginally better idea, so that if it against all odds fails it does not do so silently.
Is there an update on this?
I've tried @mskalra solution, and it seems to work.. but then I've received another error related to RCTScrollView:
@ammichael add these changes as well and you should be good: https://github.com/facebook/react-native/commit/7c8b91442b3547cf94c752f234210bef0848c00a
@mskalra Well, it did helped to stop building errors, but when it runs in simulator,
the screen is scaled down and I'm receiving errors.
I've created a gist with the Xcode and RN Packager logs: https://gist.github.com/ammichael/0c7c915216c30c7d156ffb3bc44f938d
Here how the screen is scaled:
Could you please send a pull-request with these changes? Thanks!
Hi, guys!
I have successfully fix this bug!
Copy Xcode Beta.app (xcode_8_beta.xip) in IOS10 device support files to Xcode.app (7.3.1 xcode), and then connect the device to success in ios10 version of the real machine debugging equipment
xcode 8 beta
cp -r /Applications/Xcode_beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.0\ \(14A5261u\) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
Facilitate, I upload the supporting documents, copies of xcode 7.3.1 to use!
嗨,大家好
我已经成功解决该错误了!
复制Xcode Beta.app(xcode_8_beta.xip)中的IOS10设备支持文件到Xcode.app(xcode 7.3.1)中,然后连接设备即可成功在ios10版本的设备上进行真机调试
cp -r /Applications/Xcode_beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.0\ \(14A5261u\) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
方便大家,我上传了该支持文件,拷贝到xcode 7.3.1对应目录即可使用!
Thanks @antoor this works for me!
Thanks @antoor, Worked for me as well.
Great workaround! thanks, @antoor !
Thanks, @antoor! Is anyone working on supporting Xcode 8?
I just followed your instructions @antoor, but I can't switch the Deployment Target of my application to iOS 10.0. In my case there ins't a selectable Deployment Target option for 10.0 in the dropdown. Do you have any advices?
I posted a fix here: #8584
@TimBroddin : Thank you !
@ammichael
My porblem sames to you.
It works for me.
link:http://blog.csdn.net/jeikerxiao/article/details/53183375
All the React Native Projects Written by Xcode7, When you Update to Xcode8 will get some Error, need to fix it, follow these steps.
Error:
SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
Fix it:
add: (void)
(void)SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
Or,Plan B(PS:I used it ,worked out!):
fix it:
int result = SecRandomCopyBytes(kSecRandomDefault,sizeof(uint32_t), (uint8_t *)mask_key);
assert(result == 0);
1.How to fix:
Open RCTSCrollView.m ,Command+F Search:
@implementation RCTCustomScrollView
You will find one result, and fix it:
@implementation RCTCustomScrollView
{
__weak UIView *_dockedHeaderView;
RCTRefreshControl *_refreshControl;
}
Done.
Xcode7写的所有React Native项目,在升级到Xcode8都会报错,需要做以下修改。
错误位置:
SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
解决方法(一):
加入: (void)
(void)SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
或者,解决方法(二,PS:我用的是这种):
修改为:给一个int对象接受SecRandomCopyBytes 函数并且用assert检查函数对象。
int result = SecRandomCopyBytes(kSecRandomDefault,sizeof(uint32_t), (uint8_t *)mask_key);
assert(result == 0);
1.解决方法:
打开 RCTSCrollView.m Command+F 搜索:
@implementation RCTCustomScrollView
会搜索到一个结果,然后增加一行代码:
修改为:
@implementation RCTCustomScrollView
{
__weak UIView *_dockedHeaderView;
RCTRefreshControl *_refreshControl;
}
完成。
Tried with all solutions. Still getting this error every time for all fresh project and running project also.
This is still an issue. So far React Native has many issues related to Xcode 8 and iOS 10(.2+) and even deprecated packages and thrir alternatives are not really compatible with most old setups.
How did others solve this in new projects?
Most helpful comment
Not sure if this is the right fix but I was able to get around this by casting SecRandomCopyBytes as void:
(void)SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
(void)SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
This + what nickstamas linked was enough to get it to build and deploy on ios10.