xcode 无法打开文件“<appName>.app”,因为您没有查看它的权限

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27650658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 06:25:05  来源:igfitidea点击:

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

iosxcode

提问by jbokwx

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.

无法打开文件“WxChase.app”,因为您没有查看它的权限。

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
  • 替换我的 info.plist
  • 删除派生数据
  • 复制我的应用程序
  • 编辑项目文件夹的权限
  • 在构建设置中将“C/C++/Objective-C 编译器”更改为默认值
  • 检查我的架构
  • 清理我的项目

Thanks for your help!

谢谢你的帮助!

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

更新:我无法在模拟器或手机上运行它。

回答by Gulzaman

select info

选择信息

Enter Bundle name As : ${PRODUCT_NAME}

输入包名称为: ${PRODUCT_NAME}

Executable file : ${EXECUTABLE_NAME}

可执行文件: ${EXECUTABLE_NAME}

回答by Aku

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.

当某些源代码项未包含在此特定目标的目标成员资格中时,我也看到了这种情况。无论哪种方式它都可以很好地编译,但除非您选中文件检查器中的目标成员资格框,否则它不会运行。给出的错误与上述缺少权限消息相同。

回答by Tarun Seera

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.

进入您的构建设置,将 C/C++/Objective-C 的编译器更改为默认编译器(Apple LLVM 6.0)而不是项目的不支持编译器(com.apple.compilers.llvmgcc42)。

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

在 Xcode 6 Beta 4 中运行应用程序时,您可以参考这个问题“无法打开文件“MyApp.app”,因为您无权查看它

回答by Mr.Zee

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

重新安装 pod 对我有用我的错误是:我使用更新到推荐设置警告,默认情况下 xcode 更新我的 pod,但它不会更新我的 podfile,所以只使用“pod install”对我有用

回答by Rizwan

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

我尝试了答案中列出的各种方法,但没有奏效。

Finally I did following and it worked on Xcode 10.1:

最后我做了以下工作并且它起作用了Xcode 10.1

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

构建设置->产品名称->更改产品名称

The default is $(TARGET_NAME), and rebuild.

默认为 $(TARGET_NAME),并重建。

回答by swiftBoy

On XCode 7.3I got the same issue

XCode 7.3 上我遇到了同样的问题

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
  • 默认编译器
  • 清洁和构建
  • 重置模拟器并重启模拟器、Xcode、iPhone 甚至 mac
  • 更新了 Info.plist
  • 删除派生数据
  • 编辑项目文件夹的权限
  • 检查我的架构

nothing worked :(

没有任何效果:(

How I resolved

我是如何解决的

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

我刚刚删除了那些物理文件夹,清理构建和是!!有用!!

回答by protasm

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.

我无意中从包含多个必需文件的 XCode 项目中删除了一个文件夹后,我遇到了同样的问题。奇怪的是,该文件夹包含 LaunchScreen 和 Main 故事板,以及项目的自定义(且唯一)AppDelegate ......但我能够无错误地构建项目,并且当我单击“运行”时出现的唯一错误是“您没有权限”对话框,而不是抱怨缺少文件/引用/依赖项的运行时错误。

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.

故事寓意:除了上述所有其他故障排除建议之外,请确保您的项目包含它所依赖的所有文件夹和文件。

回答by Kris Roofe

I usually do it by one of the below ways.

我通常通过以下方式之一来做到这一点。

回答by akaMahesh

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

从 Xcode > Preferences > Location 中删除派生数据并重建项目对我来说很有效。