I'm having issues running my react-native app on the iOS Simulator. It runs fine on my Windows machine on the Android simulator, so I'm pretty sure it has nothing to do with my own code.
The issue seems to have something to do with permissions.
If I run react-native run-ios
and the simulator as my user (not root), it seems to find the simulator fine, but I get an error during build:
2017-03-12 14:22:05.656 xcodebuild[2612:76143] couldn't read dependency graph from '/Users/jordan/src/anxiety-work-tracker/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/yoga.build/dgph': Permission denied
2017-03-12 14:22:05.677 xcodebuild[2612:76144] couldn't read dependency graph from '/Users/jordan/src/anxiety-work-tracker/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/jschelpers.build/dgph': Permission denied
2017-03-12 14:22:05.677 xcodebuild[2612:76143] unable to create temporary file at /Users/jordan/src/anxiety-work-tracker/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/yoga.build/dgph-1BUDub2D: Permission denied
2017-03-12 14:22:05.677 xcodebuild[2612:76144] unable to create temporary file at /Users/jordan/src/anxiety-work-tracker/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/jschelpers.build/dgph-pZNRO08O: Permission denied
2017-03-12 14:22:05.679 xcodebuild[2612:76144] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-11758/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/BuildSystem/DependencyGraph/XCDependencyGraph.mm:688
Details: unable to write dependency graph: Permission denied
Object: <XCDependencyGraph>
Method: +loadOrCreateInBuildDirectory:withTargetBuildContext:withBasePath:
Thread: <NSThread: 0x7facda2f3090>{number = 9, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2017-03-12 14:22:05.679 xcodebuild[2612:76143] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-11758/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/BuildSystem/DependencyGraph/XCDependencyGraph.mm:688
Details: unable to write dependency graph: Permission denied
Object: <XCDependencyGraph>
Method: +loadOrCreateInBuildDirectory:withTargetBuildContext:withBasePath:
Thread: <NSThread: 0x7facd9f73a90>{number = 8, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
Build Preparation
Couldn't create workspace arena folder '/Users/jordan/src/anxiety-work-tracker/ios/build': Unable to write to info file '<DVTFilePath:0x7facd9e06ec0:'/Users/jordan/src/anxiety-work-tracker/ios/build/info.plist'>'.
Couldn't update module cache session file '/Users/jordan/src/anxiety-work-tracker/ios/build/ModuleCache/Session.modulevalidation': You don’t have permission to save the file “Session.modulevalidation” in the folder “ModuleCache”.
** BUILD FAILED **
The simulator then does load the app, but has an error saying that it couldn't load from the module cache.
If I run react-native run-ios
as root and the Simluator as my user, it says that it can't find a running simulated device.
If I run both as root, I get the following when running react-native run-ios
:
** BUILD SUCCEEDED **
Installing build/Build/Products/Debug-iphonesimulator/AnxietyWorkTracker.app
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=163):
Unable to lookup service com.apple.CoreSimulator.host_support: 0x44e
Launching org.reactjs.native.example.AnxietyWorkTracker
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=163):
Unable to lookup service com.apple.CoreSimulator.host_support: 0x44e
The simulator does not load anything.
Update
Per Rob's comment, I changed the permissions/owner on the directory.
sudo chown -R <username> <srcPath>
This allowed the build to succeed running as my non-root user. Running react-native run-ios
however built, opened the Simulator, opened the app in the Simulator, and then produced this error:
I know I added this in an update to the OP, but I wanted this SO Question to be marked answered, since it has been.
Per Rob's comment, the issue was permissions on my source directory.