mjmeintjes / boot-react-native

Better development experience with ClojureScript and React Native
117 stars 14 forks source link

Trouble getting started using XCode 8.1 #75

Open keith-sparkjoy opened 8 years ago

keith-sparkjoy commented 8 years ago

@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!

livtanong commented 7 years ago

I've encountered the same problem, and my logs seem to point to permission errors.

Dec 20 14:25:50 argon com.apple.CallKit.CallDirectory[26698] <Error>: [Default] Error performing migrations: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “CallDirectory” in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/CallDirectory, NSUnderlyingError=0x7fec826015b0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
Dec 20 14:25:50 argon com.apple.CallKit.CallDirectory[26698] <Error>: [Default] Error migrating store: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “CallDirectory” in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/CallDirectory, NSUnderlyingError=0x7fec826015b0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
Dec 20 14:25:50 argon com.apple.CoreSimulator.SimDevice.3ECCFD0D-6554-48DC-B036-599A8750169B.launchd_sim[26385] (com.apple.imfoundation.IMRemoteURLConnectionAgent) <Warning>: Unknown key for integer: _DirtyJetsamMemoryLimit
Dec 20 14:25:50 argon com.apple.CallKit.CallDirectory[26698] <Error>: [Default] Unable to initialize CXCallDirectoryStore for reading and writing: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “CallDirectory” in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/CallDirectory, NSUnderlyingError=0x7fec82603160 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
Dec 20 14:25:50 argon callservicesd[26607] <Error>: [Default] Error synchronizing call directory extensions: Error Domain=com.apple.CallKit.error.calldirectorymanager Code=0 "(null)"
Dec 20 14:26:05 argon CoreSimulatorBridge[26412] <Warning>: Pasteboard change listener callback port <NSMachPort: 0x7f979fb07bf0> registered
Dec 20 14:30:32 argon routined[26392] <Error>: CoreLocation: Error occurred while trying to retrieve motion state update: CMErrorDomain Code:104
livtanong commented 7 years ago

But upgrading to react-native 0.38 and running the run-ios twice made it work. Thanks for the instructions!