10

I get the following warning when I try to run my app:

The file “WxChase.app” couldn’t be opened because you don’t have permission to view it.

I have looked through all the previous questions I could find and can't find an answer.

I have tried:

  • Replacing my info.plist
  • Deleting Derived Data
  • Duplicating my app
  • Editing the permission on the folder of the project
  • Changing "Compiler for C/C++/Objective-C" to Default in Build Settings
  • Checking my architectures
  • Cleaning My Project

Thanks for your help!

Update: I can not run it in simulator or on my phone.

jww
  • 97,681
  • 90
  • 411
  • 885
jbokwx
  • 195
  • 1
  • 2
  • 14
  • are you trying to run it in the simulator? – Michael Dautermann Dec 25 '14 at 21:06
  • Yes, I have not tired it on a phone because I have to get a cord. – jbokwx Dec 25 '14 at 21:47
  • Any `Upate to reconmmented settings`? – Zigii Wong Dec 26 '14 at 03:17
  • @user3424395 - usually the first step is to completely clean a project. Start with cleaning the project. Then close the project and clean the derived data caches. Also see [After duplicating a target in xcode 6 and building with iOS8 sdk unable to install / open it](http://stackoverflow.com/q/26219300/608639). It seems to be the exact problem. – jww Dec 26 '14 at 03:18
  • 3
    Try :Build settings->Product Name-> Change the product name,default is `$(TARGET_NAME)`, and rebuild. – Zigii Wong Dec 26 '14 at 03:19
  • Tried all of these and still getting the same message. – jbokwx Dec 26 '14 at 03:47
  • 2
    This one did the trick for me: http://stackoverflow.com/questions/24924809/the-file-myapp-app-couldnt-be-opened-because-you-dont-have-permission-to-vi – Sjakelien Apr 12 '15 at 09:59
  • I did not figure it out, and have not found a solution that works. I plan on scraping the app and moving to a new idea for a similar app under a new wame. – jbokwx Apr 25 '15 at 21:50
  • @jbokwx, have you ever found a solution for this? – Hemang Sep 03 '15 at 06:42
  • Possible duplicate of ["The file "MyApp.app" couldn't be opened because you don't have permission to view it" when running app in Xcode 6 Beta 4](https://stackoverflow.com/questions/24924809/the-file-myapp-app-couldnt-be-opened-because-you-dont-have-permission-to-vi) – Senseful Apr 24 '18 at 04:30
  • Refer to this [answer](https://stackoverflow.com/a/50167291/6521116) with a good summary of this issue. – LF00 May 04 '18 at 05:22

12 Answers12

21

select info

Enter Bundle name As : ${PRODUCT_NAME}

Executable file : ${EXECUTABLE_NAME}

Vaibhav Saran
  • 12,848
  • 3
  • 65
  • 75
Gulzaman
  • 429
  • 3
  • 11
10

I also saw this occur when some of the items of source code were not included in the Target Membership for this particular target. It compiles just fine either way, but it won't run unless you check the boxes for Target Membership in the File Inspector. The error given is the same lack of permissions message above.

Aku
  • 844
  • 9
  • 16
  • 1
    My gosh, @Aku, this lonely little no-votes answer was the key to all my problems. The solutions that worked for other people never worked for me. But this did! Thanks for throwing it out there. You've got my vote. – Le Mot Juiced Nov 17 '15 at 04:22
  • I just ran in to this issue too with this being the cause, thank you! – Rajveer Jan 13 '16 at 10:28
  • @Aku you are my savior. Now if only there was a Jack that would tell me which files to include in the target in question... – tadelv Nov 04 '19 at 09:04
4

Go into your build settings change Compiler for C/C++/Objective-C to Default compiler (Apple LLVM 6.0) instead of Unsupported Compiler(com.apple.compilers.llvmgcc42) for project.

You can refer this question "The file "MyApp.app" couldn't be opened because you don't have permission to view it" when running app in Xcode 6 Beta 4

Community
  • 1
  • 1
Tarun Seera
  • 4,212
  • 4
  • 27
  • 41
1

reinstalling pods worked for me my mistake was : i used update to recommended settings warning and by default xcode update my pods but it doesnt updatet my podfile so just using 'pod install' worked for me

Mr.Zee
  • 125
  • 1
  • 9
0

On XCode 7.3 I got the same issue

Mistake I did

I just Added physical folders and moved my files into them, problem started.

I also tried everything

  • Default compiler
  • Clean and build
  • Reset simulator and reboot simulator, Xcode, iPhone even mac
  • Updated Info.plist
  • Deleting Derived Data
  • Editing the permission on the folder of the project
  • Checking my architectures

nothing worked :(

How I resolved

I just deleted those physical folders, clean build and YESS!! It works!!

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
0

I encountered the same problem after I inadvertently removed a folder from the XCode project that contained several required files. Oddly, that folder contained both the LaunchScreen and Main storyboards, as well as the project's custom (and only) AppDelegate... yet I was able to build the project without error, and the only error presented when I clicked "Run" was the "you don't have permission" dialog box, not a runtime error complaining of missing files/references/dependencies.

Moral of the story: In addition to all of the other troubleshooting suggestions above, make sure your project contains all of the folders and files that it depends on.

protasm
  • 1,209
  • 12
  • 20
0

I usually do it by one of the below ways.

LF00
  • 27,015
  • 29
  • 156
  • 295
0

Deleting Derived data from, Xcode > Preferences > Location and rebuilding the project did the trick for me.

akaMahesh
  • 383
  • 2
  • 9
0

I tried various way listed here in the answers, not worked.

Finally I did following and it worked on Xcode 10.1:

Build settings->Product Name-> Changed the product name

The default is $(TARGET_NAME), and rebuild.

Rizwan
  • 3,324
  • 3
  • 17
  • 38
0

Choose Legacy Build System Solved my problem

File -> Workspace Settings -> Build System: Legacy Build System

Muhammad Numan
  • 23,222
  • 6
  • 63
  • 80
0

in my case, this issue happened after I added files (a folder) to my project via "Add Files to PROJECTNAME...". To fix this I had to make sure that the files are added to the right target, which is selectable at the bottom of the window, in which window you choose the files/folder to be added.

Osman
  • 571
  • 7
  • 19
0

For Ionic / Ionic (Capacitor)

Change -> CDVCamera.m

(CDVPluginResult*)resultForVideo:(NSDictionary*)info
{
   NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] absoluteString];
   return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:filePath];
}

to This

(CDVPluginResult*)resultForVideo:(NSDictionary*)info
{
    NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];

    NSArray* spliteArray = [moviePath componentsSeparatedByString: @"/"];
    NSString* lastString = [spliteArray lastObject];
    NSError *error;
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"tmp"];
    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:lastString];
   [fileManager copyItemAtPath:moviePath toPath:filePath error:&error];

   return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:filePath];
 }
Krunal Vaghela
  • 1,007
  • 2
  • 12
  • 22