每当我尝试在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 Beta 4中运行我的应用程序时,我都会得到错误:
The file "MyApp.app" couldn't be opened because you don't have permission to view it.
无论我的目标是什么模拟器或设备,都会出现此错误。
我试过:
在Xcode中删除所有来自组织者的派生数据 正在修复驱动器上的权限 手动提升构建的MyApp.app的权限 重启电脑
有没有其他人遇到过这个问题并找到了解决方案?
当前回答
我的天哪! !我花了几个小时来解决这个问题。
在XCode 7.3上,我的项目没有任何问题。
我错了
我只是添加了物理文件夹,并将我的文件移动到其中,问题开始了。
我什么都试过了
默认的编译器 清洁和构建 重置模拟器和重启模拟器,Xcode, iPhone甚至mac 更新Info.plist 删除派生数据 编辑项目文件夹的权限 检查我的架构
什么都没用:(
我是如何决定的
我是关于创建新项目,然后我只是删除那些物理 我添加的文件夹,干净的构建和是的!!
它的工作原理!
其他回答
我会进入Xcode文档所在的文件夹,点击command + I来获取信息。在底部,点击锁以解锁文件夹以编辑权限。如果权限看起来不错,勾选“应用到附带文件夹”的复选框,让它来做它的事情。我个人没有见过这个,也不确定这是否是你在编辑构建权限时在你的帖子中所说的。
信息系统出了点问题。项目的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>
我从模拟器和设备两方面来研究这个问题。
这里有一个棘手的现象。如果我将项目复制到一个新位置,那么当我第一次运行时,这个问题就有可能消失。但当我打扫干净后,这个问题就来了。
我已经尝试了这个问题几乎所有的答案,但都没有。
在版本控制系统git的帮助下,我可以检查出以前版本的代码,并查看哪些修改导致了这个问题。
在我的项目中,HEAD版本是可行的,我最新的umcommitted修改将导致这个问题。
因此,我检出我的代码的可行版本中的每个文件,以定位问题。当我签出coin.xcodeproj/project时。Pbxproj(硬币是我的应用程序名称),这个问题已经解决了。
解决方案:签出可工作的coin.xcodeproj/project。pbxproj,对于我的情况下,我只是使用HEAD版本是可以的。
git checkout HEAD coin.xcodeproj/project.pbxproj
总结一下:
project.pbxproj: checkout the workable project.pbxproj file. Build Options: set Compiler for C/C++/Objective-C to default compiler. Executable file: set to $(EXECUTABLE_NAME) or directly set to your app name. Build > Clean:just do a clean. Replace the Info.plist with a new file from a new project Duplicate Info.plist in the project: just remove the extra one. Derived Data.: Find the Derived data path by Xcode->preference->locations->Derived data, then delete it with rm -r /Users/roofe/Library/Developer/Xcode/DerivedData And there may other reasons, you can refer to “The file ”MyApp.app“ couldn't be opened because you don't have permission to view it”
我遇到了AppDelegate缺失的问题。
创建一个最小值解决了这个问题:
import UIKit
@UIApplicationMain
final class AppDelegate: UIResponder,UIApplicationDelegate {
}
我有这个错误与我的一些旧的项目,我正在从橱柜出来更新。由于某些原因,在Xcode 6中使用旧代码似乎会导致这种情况。
我已经在我所做的所有项目中修复了这个问题:
删除派生数据 在产品:做清洁 进入项目目标中的构建设置,进入构建选项,并将“Compiler for C/ c++ /Objective-C”的值更改为“Default” 编译器”。