每当我尝试在Xcode 6 Beta 4中运行我的应用程序时,我都会得到错误:

The file "MyApp.app" couldn't be opened because you don't have permission to view it.

无论我的目标是什么模拟器或设备,都会出现此错误。

我试过:

在Xcode中删除所有来自组织者的派生数据 正在修复驱动器上的权限 手动提升构建的MyApp.app的权限 重启电脑

有没有其他人遇到过这个问题并找到了解决方案?


当前回答

在设备上也有问题(不仅仅是模拟器)?


其他解决方案只是在模拟器上为我固定,而不是设备。

对我来说,这个问题发生(在Xcode 6),当我试图改变主要信息。Plist属性,同时试图改变我的应用程序名称。

在信息。plist我已经改变了可执行文件名称,而不是默认的${EXECUTABLE_NAME}…

我把这个字段误认为是在跳板图标下更改应用程序名称的字段。

其他回答

我的项目也遇到了同样的问题。后来发现项目中使用的第三方(fmdb for SQLite)文件包含Info.plist。

简单地删除信息。Plist文件为我工作!

如果你谷歌这个错误消息的文本,你会在StackOverflow,苹果开发论坛,Reddit等地方发现大约20个关于Xcode无法运行编译后的可执行文件的错误消息。

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.

对于这个错误没有通用的解决方案。错误消息是完全通用的;假设它意味着“坏二进制文件”。如果你收到它,解决方案取决于你正在尝试做什么,改变了什么,为什么你突然看到这个错误。谷歌您的具体情况,而不是这个错误消息。

在我的例子中,我感觉这是一个常见的例子,我试图做的是在现代Xcode上构建一个旧的iOS项目,我想有9年了。解决方案是切换到遗留构建系统,这导致了编译错误,因为在旧项目中没有现代架构目标,可以通过手动添加它们来修复。

我也遇到过类似的问题。不知何故,我的值键可执行文件混淆了。只需将其更改回${EXECUTABLE_NAME}(在您的项目> Info下)。为我工作!

在我的情况下主要。在“构建阶段”的“编译源”列表中没有包含main(…)函数。要检查是否是这种情况,进入Build Phases并查看,如果您的主。m出现在“编译源”列表中。

信息系统出了点问题。项目的Plist。我在Xcode 6 beta 4中创建了一个同名的新项目,然后替换了真实项目的信息。请用新的。然后,该项目建立并运行良好。

看看差异,看起来plist可能不知怎么搞混了游乐场的plist。捆绑包标识符是“com.apple.dt.playground”。iOS-18300-13”,可执行文件和捆绑包的名称是“iOS”以及其他一些奇怪的名称。

这是完整的差异,以防有人需要参考:

        <key>CFBundleDevelopmentRegion</key>
        <string>en</string>
        <key>CFBundleExecutable</key>
-       <string>iOS</string>
+       <string>${EXECUTABLE_NAME}</string>
        <key>CFBundleIdentifier</key>
-       <string>com.apple.dt.playground.iOS-18300-13</string>
+       <string>com.myCompany.${PRODUCT_NAME:rfc1034identifier}</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>iOS</string>
+       <string>${PRODUCT_NAME}</string>
        <key>CFBundlePackageType</key>
-       <string>AAPL</string>
+       <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>1.0</string>
-       <key>CFBundleSupportedPlatforms</key>
-       <array>
-               <string>iPhoneSimulator</string>
-       </array>
+       <key>CFBundleSignature</key>
+       <string>????</string>
        <key>CFBundleVersion</key>
        <string>1</string>
-       <key>DTPlatformName</key>
-       <string>iphonesimulator</string>
-       <key>DTSDKName</key>
-       <string>iphonesimulator8.0</string>
-       <key>LSBackgroundOnly</key>
-       <true/>
        <key>LSRequiresIPhoneOS</key>
        <true/>
+       <key>UIMainStoryboardFile</key>
+       <string>Main</string>
        <key>UIRequiredDeviceCapabilities</key>
        <array>
                <string>armv7</string>
        </array>
+       <key>UISupportedInterfaceOrientations</key>
+       <array>
+               <string>UIInterfaceOrientationPortrait</string>
+               <string>UIInterfaceOrientationLandscapeLeft</string>
+               <string>UIInterfaceOrientationLandscapeRight</string>
+       </array>
 </dict>
 </plist>