[英]File couldn't be opened because you don't have permission
I keep getting the error: 我一直收到错误:
The file "Blah" couldn't be opened because you do not have permission to view it.
I tried the top 5 answers in this question - 我在这个问题上尝试了前5个答案 -
"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 “无法打开文件”MyApp.app“,因为在Xcode 6 Beta 4中运行应用程序时,您无权查看它
But they do not work. 但它们不起作用。
Note: I deleted the debug
and release
from the Test
in the Build Settings
and cleared the derived data multiple times. 注意:我在Build Settings
从Test
中删除了debug
和release
,并多次清除派生数据。
info.plist info.plist中
Go to Build Settings -> Build Options. 转到构建设置 - >构建选项。 Then change the value of the "Compiler for C/C++/Objective-C" to Default Compiler. 然后将“Compiler for C / C ++ / Objective-C”的值更改为Default Compiler。
I faced the same problem today, in my case the application name was containing space like (XY), In info.plist Xcode converts the name to (XY) in the Executable file property, so I changed the application name to be like (XY) without space and the problem disappeared ! 我今天遇到了同样的问题,在我的情况下,应用程序名称包含类似(XY)的空间,在info.plist中Xcode将名称转换为(XY)在Executable文件属性中,所以我将应用程序名称更改为(XY) )没有空间,问题就消失了! hope this will help anybody :) 希望这会对任何人有所帮助:)
It appears you are getting this error while running your XCTest target. 运行XCTest目标时,您似乎遇到此错误。
I've seen cases where the test target has no permission for files belonging to the app target. 我见过测试目标对属于app目标的文件没有权限的情况。
This worked for me: 这对我有用:
Now you write the code that accesses the file in your app code that is compiled into your app target. 现在,您编写访问应用程序代码中的文件的代码,该代码将编译到您的应用程序目标中。
From your XCTest class you call the method in the app target that has the permission to access app files. 在您的XCTest类中,您可以调用具有访问应用程序文件权限的应用程序目标中的方法。
Please make sure that you have this. 请确保你有这个。 If not you can edit that. 如果没有,你可以编辑它。
1.$(BUILT_PRODUCTS_DIR)/yourappname.app/yourappname 1。$(BUILT_PRODUCTS_DIR)/yourappname.app/yourappname
2.In info.plist make sure that Executable file value is this only "$(EXECUTABLE_NAME)" 2.在info.plist中确保可执行文件的值仅为“$(EXECUTABLE_NAME)”
3.You may be need to give permission to your folder as read & write. 3.您可能需要授予您的文件夹读写权限。 For this you need to follow these steps: a. 为此,您需要按照以下步骤操作: Right click b.get info c. 右键单击b.get info c。 unlock it and give your password d. 解锁并提供密码d。 then give read & write permission to yourself. 然后给自己读写权限。
Hope this will help you out. 希望这会帮助你。 I had the same issue and i solved it by following these steps. 我有同样的问题,我按照这些步骤解决了这个问题。
I've just found another potential cause for this error 我刚刚发现了这个错误的另一个潜在原因
Xcode will say "you do not have permission" if the .app
file does not contain a valid binary (you can inspect the .app
file by right-clicking on it and selected Show Package Contents -- you're looking for something with an icon of a terminal with the green letters "exec") 如果.app
文件不包含有效的二进制文件,Xcode会说“你没有权限”(你可以通过右键单击它并选择显示包内容来检查.app
文件 - 你正在寻找带有带有绿色字母“exec”的终端的图标)
The binary may be missing for a number of reasons (failed compilation, failed linking, etc) - but you can usually find a hint by clicking on the "warnings" tab above the file list in Xcode. 由于多种原因(编译失败,链接失败等),二进制文件可能会丢失 - 但您通常可以通过单击Xcode中文件列表上方的“警告”选项卡找到提示。 In my case I was referencing a third-party library but needed to add it to the "Link Binary with Libraries" build phase 就我而言,我引用了第三方库,但需要将其添加到“Link Binary with Libraries”构建阶段
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.