xcode myProject 已锁定无法编辑,您可能无法保存更改?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9574543/
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-09 04:17:23  来源:igfitidea点击:

myProject is locked for editing and you may not be able to save your changes?

xcodefile-permissions

提问by Woof

I get the following error messages when I moved my code from my laptop to my Mac Mini and opened it over there:

当我将代码从我的笔记本电脑移到我的 Mac Mini 并在那里打开它时,我收到以下错误消息:

myProject is locked for editing and you may not be able to save your changes?

myProject 已锁定无法编辑,您可能无法保存更改?



myProject is currently locked because you are not the owner of the file and do not have write permission.

myProject 当前被锁定,因为您不是该文件的所有者并且没有写权限。



The file "xxx.xcuserdatad" could not be unlocked. Could not add write permission to the file because you do not own it. Try modifying the permission of the file in the Finder or Terminal.

无法解锁文件“xxx.xcuserdatad”。无法向文件添加写入权限,因为您不拥有它。尝试在 Finder 或终端中修改文件的权限。



I did a search with Finder: What came up was a file called UserInterfaceState.xcuserstate inside of xxx.xcuserdatad... GetInfo showed the file not to be locked.

我用 Finder 进行了搜索:结果是在 xxx.xcuserdatad 中出现了一个名为 UserInterfaceState.xcuserstate 的文件... GetInfo 显示该文件未被锁定。

However looking at the path(from GetInfo) showed the file to be within "xxx.xcodeproj" and further within "project.xcworkspace/xcuserdata/xxx.xcuserdatad"

然而,查看路径(来自 GetInfo)显示该文件位于“xxx.xcodeproj”内,并进一步位于“project.xcworkspace/xcuserdata/xxx.xcuserdatad”内

I can't find this anywhere, and I don't know how to use my project on another computer.

我在任何地方都找不到这个,而且我不知道如何在另一台计算机上使用我的项目。

回答by user2848810

Go to the Folder in Finder where the xcode project is and right click -> Get info. The permissions and the bottom should be set to read/write and in my case they were. The trick is to click the settings icon at the bottom and select "Apply to enclosed items". The chmod method shown above doesn't change the permissions of the contents within the folder.

转到 Finder 中 xcode 项目所在的文件夹,然后右键单击 -> 获取信息。权限和底部应该设置为读/写,在我的情况下它们是。诀窍是单击底部的设置图标并选择“应用于封闭项目”。上面显示的 chmod 方法不会更改文件夹中内容的权限。

回答by Rami Nour

  1. go to the folder in finder
  2. right click on folder and click the "Get info"
  1. 转到finder中的文件夹
  2. 右键单击文件夹,然后单击“获取信息”

enter image description here

在此处输入图片说明

  1. go down to the bottom and click the lock and write administrator password
  1. 到底部并单击锁定并写入管理员密码

enter image description here

在此处输入图片说明

  1. now click on the settings icon and press "Apply to enclosed items..."
  1. 现在单击设置图标,然后按“应用于封闭项目...”

enter image description here

在此处输入图片说明

回答by user8128167

Please note that I had to add the recursive command flag and sudoto get it to work for me:

请注意,我必须添加递归命令标志并sudo让它对我来说有效:

$ sudo chown -R Roger my_app_folder/*

And:

和:

$ sudo chmod -R 774 my_app_folder/*

Because I was getting this error:

因为我收到了这个错误:

chmod: Unable to change file mode on my_app_folder: Operation not permitted

chmod:无法更改 my_app_folder 上的文件模式:不允许操作

回答by Pochi

Have you tried copying the contents like suggested in this answer?: Unable to unlock file for editing in Xcode 4?

您是否尝试复制此答案中建议的内容?: 无法在 Xcode 4 中解锁文件进行编辑?

Alternatively you could use the console to set yourself a writing permission on all the files for your xcode project:

或者,您可以使用控制台为自己的 xcode 项目的所有文件设置写入权限:

http://www.mac-terminal.com/files-and-folders/permissions/chmod/

http://www.mac-terminal.com/files-and-folders/permissions/chmod/