Reputation: 94803
Whenever I try to run my app in Xcode 6 Beta 4 I am getting the error:
The file "MyApp.app" couldn't be opened because you don't have permission to view it.
This error appears no matter what simulator or device I target.
I have tried:
Has anyone else run into this problem and found a solution?
Upvotes: 295
Views: 194577
Reputation: 14073
You can also get this error when the path is incorrect or attempting to get the contents of a folder instead of a path.
Upvotes: 0
Reputation: 1646
My use case was somewhat unique. I was using the info_plist
property of an app_spec
to additionally specify info.plist
properties via a Hash.
However, setting the CFBundleExecutable
key resulted in the permissions error. Removing it did the job for me.
Upvotes: 0
Reputation: 9565
If you google the text of this error message you will find maybe 20 threads across StackOverflow, Apple dev forums, Reddit, etc. about Xcode failing to be able to run a compiled executable with this error message.
In these threads you will find many people offering various suggestions about how to fix the problem: changing product name to match project name, changing build phase options, something with info.plist, changing compilers to or from Clang, etc. Presumably the suggestions are offered in good faith because they solved the problem for someone, but the answers are so varied that it is clear that the error message is generic and this is an important point if you are receiving it: this error seems to mean that something is wrong with the binary. Ignore its actual text: it may have nothing to do with permissions.
There is no general solution to this error. The error message is totally generic; assume it means "bad binary file". The solution if you are receiving it depends on what you are trying to do, what has changed, why you are seeing this error all of a sudden. Google the specifics of your situation rather than this error message.
In my case, and I have a feeling this is a common case, what I was trying to do was build an old iOS project, nine years old I think, on modern Xcode. The solution was to switch to the legacy build system which led to a compilation error because in the old project there were not modern architecture targets, which could be fixed by manually adding them.
Upvotes: 6
Reputation: 3394
What I did is here:
Also, File -> Project/Workspace Settings == New Build System
Xcode Version 12.0 (12A7209)
Upvotes: 8
Reputation: 1164
Maybe consider installing the latest version of Xcode.
I did that after trying all the other solutions (which did not work for me) and the issue was automagically fixed.
Upvotes: 0
Reputation: 1823
None of the solutions worked for me in Xcode 10.3 when I added two objective-c files to my project. I fixed by following the below steps,
-objc
flag for compiler flags right next to the .m fileUpvotes: 0
Reputation: 245
This message will also appear if you use .m files in your project which are not added in the build phase "compiles source"
Upvotes: 0
Reputation: 592
None of the provided answers worked for me. In my case, I finally fixed the error by updating the target architectures in Build Settings/Architectures/Valid Architectures to $(ARCHS_STANDARD), as arm64 was missing. This was not prohibiting the project to build, although a warning was issued recommending updating the valid architectures, but the "app could not be opened" error was shown at run time.
I surmise this error is rather generic and not always linked with a permission issue, but may be displayed when the generated app package is invalid.
Upvotes: 2
Reputation: 1823
I got this issue in Xcode 10.1 after adding objective c files to my swift project. Got this working by following the below steps,
Upvotes: 0
Reputation: 2879
My Application was working fine on XCode 9.4, but when I opened my project in XCode 10 I was experiencing this issue. For me the issue was the build setting. I found the answer in this page https://forums.developer.apple.com/thread/112141.
In short go to File > Workspace Settings… > Build System and change it to "Legacy Build System"
Upvotes: 11
Reputation: 69
I updated my cocoa pods and added new supported architectures in build settings and that fixed it.
Upvotes: 0
Reputation: 8146
The error message is generic and doesn't actually tell you what it really mean.
For me I had to restore earlier github reversions which gave:
armv7 armv7s arm64
to the architecture.
Upvotes: 2
Reputation: 303
I had the same issue with Xcode 10 & react-native. All the above solutions didn't help me.
My solution: Create a new project with the same name. And change project & workspace files with the ones from the duplicated project. And it works!!! (after some small build-issues with path etc)
Upvotes: 0
Reputation: 28564
I came to this issue both on simulator and device.
And there is a tricky phenomenon. If I copy the project to a new place, there is some chance this issue gone when I first run. But after I clean and run, this issue comes.
I have try almost all the solution from the answers to this question, but neither do.
With the help of the version control system git, I can check out the previous version of the code and to see what modification lead to this issue.
In my project the HEAD version is workable, and my latest umcommitted modification will lead to this issue.
So I checkout each file from the workable version of my code to locate the issue. When I checkout the coin.xcodeproj/project.pbxproj
(coin is my app name), this issue gone.
Solution: just checkout the workable coin.xcodeproj/project.pbxproj
, for my case I just use the HEAD version is ok.
git checkout HEAD coin.xcodeproj/project.pbxproj
To make it a summary:
Compiler for C/C++/Objective-C
to default compiler.$(EXECUTABLE_NAME)
or directly set to your app name.Xcode->preference->locations->Derived data
, then delete it with rm -r /Users/roofe/Library/Developer/Xcode/DerivedData
Upvotes: 0
Reputation: 49
I fixed this by clearing my derived data from the preferences in xcode
Upvotes: 0
Reputation: 36447
I had the same issue in my project. Later on found that third-party (fmdb for SQLite) file used in project contained Info.plist.
Simply deleting the Info.plist file worked for me!
Upvotes: 10
Reputation: 17902
The other solutions only fixed it for me on simulator, not device.
For me this problem occurred (in Xcode 6) when I would try to change the main info.plist properties whilst trying to change my app name.
In info.plist I had changed Executable File
name to something other than the default ${EXECUTABLE_NAME}
...
I had mistaken this field for the field that changes the name of the app under the icon on the springboard.
Upvotes: 150
Reputation: 2078
I've had same this error in Xcode 8.2. The reason I found out for me, another Info.plist is added in my project while adding library (manually copy).
So that Xcode is getting confused for selecting correct Info.plist.
I just removed that Info.plist from the added library.
Then it is working fine without any permission alert.
Upvotes: 29
Reputation: 651
For me the error was in the .plist file at the key CFBundleExecutable
.
I had renamed the executable removing a space that was between two words. (Eg: from "Wild Racer" to "WildRacer"). Took 1 day to spot it!!
Xcode is soooo unhelpful in the debugging!
Upvotes: 5
Reputation: 631
I had similar issues. Apparently I've included Info.plist from outside project folder. That lead to the same error, shown after every build (except after I run it after cleaning the project).
To fix it I simply had to include Info.plist from the project folder.
Upvotes: 2
Reputation: 562
Please also check if you have added any third party lib with plist. Some time third party lib has the info plist causing the issue .
Upvotes: 0
Reputation: 1239
Try "cmd+shift+k" to clean the project and rebuild. At least it worked for me
Upvotes: 13
Reputation: 5215
Select Scheme Menu by pressing needed button on the right of run/stop buttons:
Press Edit Scheme... :
Select your executable:
Upvotes: 0
Reputation: 17564
I had the issue that the AppDelegate was missing.
Creating a minimal one solved the issue:
import UIKit
@UIApplicationMain
final class AppDelegate: UIResponder,UIApplicationDelegate {
}
Upvotes: -1
Reputation: 35783
My goodness!! I spent hours to resolve this issue.
On XCode 7.3 I was having project with no issues.
Mistake I did
I just Added physical folders and moved my files into them, problem started.
I tried everything
nothing worked :(
How I resolved
I was about create new project and then I just deleted those physical folders I added, clean build and YESS!!
It works!!
Upvotes: 14
Reputation: 6861
I changed name to new name then I returned the old name to my project and it helped me.
Upvotes: 1
Reputation: 3163
I use Xcode6 GM. I encountered the same problem. What I did was to go to Build Settings -> Build Options. Then I changed the value of the "Compiler for C/C++/Objective-C" to Default Compiler.
Upvotes: 255
Reputation: 3955
On my part, what trigger this error was that I had, at the root of my resources folder, a folder with the same name as my final executable file.
So, when launching the executable, I think Xcode found the folder and had problem executing a folder! ;-)
Upvotes: 0
Reputation: 1894
I tried all of the listed answers and none of them was useful. The problem was due to existence of an another plist file linked from a submodule via cocoapods. Luckily this was my own module, so I just deleted this plist from the submodule project and reinstalled pods.
Later on I understood that the key of the problem was in the name of that second plist: simply info.plist
. You may rename the file and relink it via a sources
section of a submodule
That second plist file had a unique name, so Xcode was not supposed to become frustrated. Even my target settings pointed on a main plist, not on a info.plist
. Looks like Xcode takes special consideraions about that name
The bug reproduced in Xcode 6.4 and Xcode 7.0
Upvotes: 9
Reputation: 1421
Please check if you have changed Executable file => $(EXECUTABLE_NAME) to any other name. If you have changed this name then it shows this error. Please replace it with $(EXECUTABLE_NAME).
Upvotes: 17