简体   繁体   中英

Couldn’t be opened because you don’t have permission to view it - React Native - Expo?

After ejecting the Expo project using expo eject , and try to run the project using Xcode "11.7" & Command-line "For iOS "

I got these errors,

Note:

Android Works well after ejecting

iOS & Android Works well before Ejecting.

Xcode

Details

The file “MyApp” couldn’t be opened because you don’t have permission to view it.
Domain: NSCocoaErrorDomain
Code: 257
Failure Reason: You don’t have permission.
Recovery Suggestion: To view or change permissions, select the item in the Finder and choose File > Get Info.
User Info: {
    NSFilePath = "/Users/username/Library/Developer/Xcode/DerivedData/MyApp-bnfffrwsrhskljawuujrmpuwldgt/Build/Products/Debug-iphonesimulator/MyApp.app";
}
--
The operation couldn’t be completed. Permission denied
Domain: NSPOSIXErrorDomain
Code: 13
Failure Reason: Permission denied
--


System Information

macOS Version 10.14.6 (Build 18G95)
Xcode 11.7 (16142)

Architectures

架构

Command-line

npx react-native run-ios

info Found Xcode workspace "MyApp.xcworkspace"
info Launching iPhone 11 (iOS 13.7)
info Building (using "xcodebuild -workspace MyApp.xcworkspace -configuration Debug -scheme MyApp -destination id=60F7E669-0AE4-4CF3-9BC8-17027D01B172")
success Successfully built the app
info Installing "/Users/username/Library/Developer/Xcode/DerivedData/MyApp-bnfffrwsrhskljawuujrmpuwldgt/Build/Products/Debug-iphonesimulator/MyApp.app"
An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=1):
This app could not be installed at this time.
Could not install at this time.
Failed to chmod /Users/username/Library/Developer/CoreSimulator/Devices/60F7E669-0AE4-4CF3-9BC8-17027D01B172/data/Bundle/Application/3C7513F0-9BFE-4C94-A722-7C1BE6898E54/MyApp.app/MyApp : No such file or directory
Underlying error (domain=MIInstallerErrorDomain, code=4):
        Failed to chmod /Users/username/Library/Developer/CoreSimulator/Devices/60F7E669-0AE4-4CF3-9BC8-17027D01B172/data/Bundle/Application/3C7513F0-9BFE-4C94-A722-7C1BE6898E54/MyApp.app/MyApp : No such file or directory
info Launching "com.MyApp"
error Failed to launch the app on simulator, An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=1):
The request to open "com.MyApp" failed.
The request was denied by service delegate (SBMainWorkspace) for reason: NotFound ("Application "com.MyApp" is unknown to FrontBoard").
Underlying error (domain=FBSOpenApplicationErrorDomain, code=4):
        The operation couldn’t be completed. Application "com.MyApp" is unknown to FrontBoard.
        Application "com.MyApp" is unknown to FrontBoard.
  • Failure Reason: You don't have permission.

First of all please be sure that delete the derived data

If it didn't work then change permission for Terminal . Detail link is here


Probably you would not need this but just in case:

Maybe disabling system integrity protection with csrutil disable works for you.

Highly recommend you to read the Apple document first.

I also had this problem when I used react-native to create a new project.I had solved this problem.

System Information macOS Version 10.14.4 Xcode 11.3.1 (16142)

run "react-native --version" in project directory. The version is "react-native: 0.64.0". I used "npx react-native init interview --version 0.63.4" to create a new project.It worked!

So I guess use the older version to create a new project can solve your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM