简体   繁体   中英

The file “project.pbxproj” could not be unlocked in Xcode 8.3.3

Due to some reason some of files were locked in xcode, which i resolved through the this solution.

but even after that i keep getting this error

****The file “project.pbxproj” could not be unlocked.**
Could not add write permission to the file because you do not own it. Try modifying the permissions of the file in the Finder or Terminal.**

I have also tried unlocking it through above method and it is not working, also i'm not even able to close the project and when i force close it, next time all the previous changes are gone.

权限问题 试试

sudo Chmod 777 .

"Could not add write permission to the file because you do not own it"

This means that the project was created by a different user . Log as that user, or if you cannot, create a "test.txt" file next to the file you can't unlock.

Open Terminal, go to the folder where the project resides, and run a command such as

ls -la test.txt project.pbxproj

You should see a list such as:

-rw-rw-r--  1 dakkar users  434 Nov 23 12:17 project.pbxproj
-rw-r--r--  1 lserni users    1 Nov 25 00:14 test.txt

Now, the "-rw-r--r--" is the permission. You just created test.txt, so those are the correct permissions from the GUI. r counts for 4, w counts for 2, x counts for one; rw-r--r-- is therefore 6,4,4. In the example, project.pbxproj is 6,6,4.

So the two commands you need are

sudo chown lserni:users project.pbxproj  # To set ownership
sudo chmod 644 project.pbxproj           # To set permissions

If you are in the project directory and are absolutely, utterly, deadly sure that nothing there or in its subdirectories should belong to anyone but you, then you can mass-change ownership of the directory, its subdirectories and all they contain:

sudo chown lserni:users -R .

If you do the above in the wrong directory (not yours, not a project directory, etc.), the -R (recursive) flag is a recipe for disaster, so be careful.

Just in case, remember that directories must have all x's set, so what is 644 for a file would become 755 for a directory.

When finished, you can delete the example file 'test.txt' - actually you can do that as soon as you have written down what the correct ownership and permissions should be.

Same Issue. I thing it's permission problem. Try sudo Chmod 777 yourProjectFolder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM