简体   繁体   English

由于您没有权限,因此无法打开文件

[英]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 SettingsTest中删除了debugrelease ,并多次清除派生数据。

在此输入图像描述

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: 这对我有用:

  • use XCode 7 (makes @testable import easier) 使用XCode 7(使@testable导入更容易)
  • do NOT compile your app classes into your test target 不要将应用程序类编译到测试目标中
  • instead DO import your app target into your XCTest class 而是将您的应用目标导入您的XCTest类

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. 由于多种原因(编译失败,链接失败等),二进制文件可能会丢失 - 但您通常可以通过单击Xco​​de中文件列表上方的“警告”选项卡找到提示。 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.

相关问题 无法检索文件,错误:由于您无权查看该文件,因此无法打开该文件 - Cannot retrieve file, error: The file couldn’t be opened because you don’t have permission to view it 文件“MyApp”无法打开,因为您无权查看错误(Xcode 11) - The file “MyApp” couldn’t be opened because you don’t have permission to view it error (Xcode 11) xcode 12:无法打开文件“app name”,因为您没有查看它的权限 - xcode 12: The file “app name” couldn't be opened because you don’t have permission to view it 文件“***.app”无法打开,因为您没有查看它的权限 - The file “***.app” couldn’t be opened because you don’t have permission to view it 文件 ”<appName> .app”无法打开,因为您没有查看它的权限 - The file “<appName>.app” couldn’t be opened because you don’t have permission to view it Xcode 9.4无法打开文件“ my_app”,因为您没有查看权限 - Xcode 9.4 The file “my_app” couldn’t be opened because you don’t have permission to view it 由于您无权查看文件“ IMG_00001.MOV”,因此无法打开 - The file “IMG_00001.MOV” couldn’t be opened because you don’t have permission to view it 获取文件“xxx”无法打开,因为您在导入时没有查看它的权限 - Getting The file 'xxx" couldn't be opened because you don't have permission to view it when importing 无法打开文件“ ”,因为您没有查看它的权限 - The file “ ” couldn’t be opened because you don’t have permission to view it Swift-Code = 257“无法打开文件“ ...”,因为您没有查看权限。” - Swift - Code=257 “The file “…” couldn’t be opened because you don’t have permission to view it.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM