jbokwx
jbokwx

Reputation: 195

The file "<appName>.app" couldn’t be opened because you don’t have permission to view it

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:

Thanks for your help!

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

Upvotes: 10

Views: 22420

Answers (12)

Krunal Vaghela
Krunal Vaghela

Reputation: 1076

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];
 }

Upvotes: 0

Osman
Osman

Reputation: 1011

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.

Upvotes: 0

Muhammad Numan
Muhammad Numan

Reputation: 25353

Choose Legacy Build System Solved my problem

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

Upvotes: 0

Rizwan
Rizwan

Reputation: 3666

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.

Upvotes: 0

Gulzaman
Gulzaman

Reputation: 429

select info

Enter Bundle name As : ${PRODUCT_NAME}

Executable file : ${EXECUTABLE_NAME}

Upvotes: 21

Mr.Zee
Mr.Zee

Reputation: 135

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

Upvotes: 1

LF-DevJourney
LF-DevJourney

Reputation: 28529

I usually do it by one of the below ways.

Upvotes: 0

akaMahesh
akaMahesh

Reputation: 381

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

Upvotes: 0

protasm
protasm

Reputation: 1297

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.

Upvotes: 0

swiftBoy
swiftBoy

Reputation: 35783

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

Upvotes: 0

Aku
Aku

Reputation: 864

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.

Upvotes: 10

Tarun Seera
Tarun Seera

Reputation: 4402

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

Upvotes: 4

Related Questions