-
Notifications
You must be signed in to change notification settings - Fork 14
Trouble getting started using XCode 8.1 #75
Description
@pesterhazy helped me get past all of this and asked if I'd write up some of the roadblocks as an issue, so here goes.
Following the guidance here http://presumably.de/boot-react-native.html
npm install - worked fine
npm start - this isn't in the blog post, but @pesterhazy suggested that it should be.
boot dev - worked fine
react-native run-ios - build error
The following build commands failed:
CompileC /Users/keith/src/example/app/ios/build/Build/Intermediates/RCTWebSocket.build/Debug-iphonesimulator/RCTWebSocket.build/Objects-normal/x86_64/RCTSRWebSocket.o RCTSRWebSocket.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
/Users/keith/src/example/app/node_modules/promise/lib/done.js:10
throw err;
^
@pesterhazy suggested I scroll back to find the source of the error, and indeed, I found this:
/Users/keith/src/example/app/node_modules/react-native/Libraries/WebSocket/RCTSRWebSocket.m:494:3: error: ignoring return value of function declared with warn_unused_result attribute [-Werror,-Wunused-result]
SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
^~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/keith/src/example/app/node_modules/react-native/Libraries/WebSocket/RCTSRWebSocket.m:1334:5: error: ignoring return value of function declared with warn_unused_result attribute [-Werror,-Wunused-result]
SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
^~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
@pesterhazy thought this problem might be because in XCode 8, Apple upgraded what used to be a warning into an error. He suggested updating to react-native 0.33. I ended up having to also upgrade react-native and react-dom. I changed the "dependencies" section of example/app/package.json from this
"dependencies": {
"react": "15.2.1",
"react-dom": "15.2.1",
"react-native": "0.30.0"
}
to this (note all three dependencies changed):
"dependencies": {
"react": "15.3.1",
"react-dom": "15.3.1",
"react-native": "0.33.0"
}
...and reran npm install, after shutting everything down.
So let's try again:
boot dev (which patched the new react-native)
npm start
react-native run-ios
Build succeeded, and the simulator flashes "SimpleExampleApp" briefly but then stays blank white for a pretty long time. Eventually it turns red complaining that it can't connect to the dev server. The URL it tries to use to get the bundle looked like this:
http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false
While all this was happening I noticed the package manager was still in its "find dependencies" phase. That took almost two minutes to complete - I finally saw an find dependencies after waiting awhile. During that time I wasn't able to access the URL above with a browser, but it seems like after that was done, I was able to see javascript returned from it.
After that, pressing cmd-R a couple times to refresh the simulator got things working, and I was happy to see "Welcome to boot-react-native" with a button at the bottom that when I clicked it, the number increased, as advertised.
Hope this is helpful!