Xcode 11.3 not opening Assets.xcassets file on all my projects - permissions

After downloading Xcode 11.3 (twice) I keep getting this message when I try to build any of my existing projects: The file “Preview Assets.xcassets” couldn’t be opened because you don’t have permission to view it.
I've used "get info" to check the permissions for Assets.xcassets. Even though the permissions looked good, I changed them again. I also tried the other solutions for this problem from earlier versions, deleted and re-added the Assets.xcassets files, re-booted my Mac, deleted and reloaded Xcode.
Any ideas what to try next? Thanks.

Go to Finder Assets.xcassets -> properties -> access rights and access (or how it would be in english). Grant access to read and write for all users
Add all assets in Xcode (if you deleted them). Try to build
If failed, then grand access again.

Related

XCode 6.0.1 error when creating project: The file "exclude" doesn't exist

When I create a new project in XCode 6.0.1, I got this error message: The file "exclude" doesn't exist
It seems to only impact the versioning of the files i.e. the generated stub files are not committed into github after the project is created.
What can cause this problem?
For me the issue was caused because I had previously created a project with the same name, and Xcode still had record of that.
To clear it out,
go to Window -> Organizer in the menu bar
Remove all of the repositories highlighted in red
To add your repository (if it's not being tracked for some reason),
Click the + (still in Window -> Organizer from the steps above)
Enter the path of your file
Make sure to change to Git from Subversion (if Xcode has Subversion set as default - it did for me.
I usually get this error if I initialize an Xcode project with a git repository, delete it and try to recreate it with the same name (casing doens't appear to make it sufficiently 'different'). Turns out, "Well I'll just start over" can leave some issues as well.
Hope this helps.
I had this issue as well, and I tracked it down to the .git-template folder included with Thoughtbot's dotfiles. Basically, Xcode expects its template folder to have info/exclude, and Thoughtbot's dotfiles don't. Creating that directory and file fixed the problem, as so (in the Terminal):
cd ~/.git_template
mkdir info
cd info
touch exclude
If you're getting this issue without Thoughtbot's dotfiles, you could probably look at ~/.gitconfig and use whatever templatedir is getting set as instead of ~/.git_template in the first command.

Xcode: Permissions denied upon changing Bundle ID

Trying to change Bundle IDs for an Xcode project (iCloud is enabled) and I'm getting a "Could not launch app, permission denied" immediately after changing the Bundle Identifier within Xcode. Prior to changing it, it works totally fine. Provisioning profiles appear to be fine, as do the entitlements file. Really confused. Also did a clean and removed /developer/xcode/derivedData. Any help?
Zach

Xcode: "The document could not be saved. You don’t have permission."

I'm getting this error when trying to save a file in Xcode 4:
"The document could not be saved. You don’t have permission. To view or change permissions, select the item in the Finder and choose File > Get Info."
Naturally, saving the file in TextMate works fine. Permissions: -rw-r--r--
Nothing changed from when it worked the last time.
Files are not locked, I tried rebooting, disk space is ok, files are on a local drive, error was googled. Any ideas?
Thanks.
Update: Also tried copying the files or renaming them. Directories are not locked. By the way, when I edited project configuration in Xcode it saves fine, I only met with the issue saving .m/.h files. I guess that copying the actual text in the files would work but I'm trying to find a bit less hardcore solution (bash script wouldn't be the issue but there could be other problems). It's not the simplest project either (~70 files, edited config).
Update 2: Found possible duplicate, doesn't really resolve the problem Unable to unlock file for editing in Xcode 4?
Update 3: Checked out earlier commit and when opening Xcode it said the project is locked. Checked out the same commit again and the error does not appear again (all files exc. DS_Store are tracked). What.
Update 4: I created a new user and set chmod -R 777 to the project directory. Editing now works fine. However I can't get it to work under my main account (I have all my preferences here.)
Rebooting fixed the error in my case.
Fixed by changing account name by following this guide. This essentialy creates a new account but with your old Home directory and within the process of transferring it fixes some file permissions.
(From above link:)
For Mac OS X v10.5 or later (do this twice if you want to keep your original username)
:
Enable the root user.
Log in as root.
Navigate to the /Users folder.
Select the Home folder with the short name you want to change, and rename it just like you would rename any folder. Keep in mind that the shortname must be all lowercase, with no spaces, and only contain letters.
Use the Users & Groups pane (Accounts pane in Mac OS X v10.6.8 or earlier) in System Preferences to create a new user with the Account name or Short Name that you used in the previous step.
Click OK when "A folder in the Users folder already has the name 'account name'. Would you like to use that folder as the Home folder for this user account?" Note: This will correct the ownership of all files in the Home folder, and avoid permissions issues with the contents.
Choose Log Out from the Apple menu.
Log in as the newly created user. You should be able to access all of your original files (on the desktop, in Documents, and in the other folders of this Home).
After verifying that your data is as expected, you can delete the original user account via the Users & Groups pane (Accounts pane in Mac OS X v10.6.8 or earlier).
Disable the root user.
Xcode 6 update: still seeing this problem.
Seems like an Xcode bug, because opening the file by clicking the error in the Issue navigator causes this problem, but if I open the file using the cmd+shift+O shortcut I am able to edit and save it. So for me the workaround is to not open the file by selecting the error and to open it using the Project navigator or Open quickly shortcut.
I upgraded to Lion and downloaded the new Xcode and found the same problem and found nothing to help, losing about three days trying to fix it. Then I realized that the Xcode 4, which is saved in the Applications folder, doesn't overwrite Xcode 3, which is in the Developer folder. When I was opening Xcode, I was opening version 3, not 4.
Make sure you're opening the right version.
open up the terminal and set
chmod 777
to the desired file or set
chmod -R 777
to the desired directory.
it should solve your problem
I just ran into this issue also. I was not able to fix it not by changing the permissions of the individual project file or folder. However, I was able to fix it by going into 'get info' on my user's home folder, reselecting the 'Read & Write' permissions for my user, and then clicking the gear->'apply to enclosed items'. Took it a while but then everything worked as expected. Hope it helps someone else.
This maybe helpful If you use CocoaPods: https://stackoverflow.com/a/38885499/3395008
I'm running Xcode 7.3 and CocoaPods 1.0.0. and this happens when trying to modify a file from a pod added as a development pod (i.e. from a local directory).
I just pod update again, when pod finished, Xcode will show an alert "The document has previously unsaved changes.", then click "Re-Save". that fix my issue.
I Had the same problem with actual swiftUI.
Solved the Problem easy:
Copy and paste the content from .swift-file to a word-document
Delete the swift-file
Close Xcode and reboot Hardware
New .swift-file in XCode and paste code from word-document
cmd+B ... cmd+r
I used to encounter the same problem several times, last time it was on Xcode 12.4
It seems like a bug for me, because it tells that some private file is modified despite I don't have any permissions to do so even if I want. Force quitting and relaunching the Xcode always helped before.

Xcode will not open my project

I where working with a project and I closed because my computer was geting slow. When I tried to open my solution again xcode quitted. So everytime I try to open my project I get this error:
I am not able to open my solution. IS THERE A WAY I CAN RECOVER MY PROJECT!?
Nothing mentioned above/below worked for me. Here's what I did instead:
Right click on the .xcodeproj file and select Show Package Contents. Then delete the project.xcworkspace file. Open the project in Xcode and voilà.
There are a couple of things you can try, first make sure Xcode is not running ,trash the ~/Library/Cache/ folder contents, and trash the contents of the ~/Library/Developer/Xcode/DerivedData/ folder, if you what to can just find the stuff for your project in ~/Library/Developer/Xcode/DerivedData/ and trash just that. Then restart your computer.
If that doesn't work, rename your faulty projects folder to so method like ' old', create a new project of the same name, and then move all of the source files from ' old' to you new project and add them. Its a bit painful I known but I have had to do this once to get a project working again.
Double click the actual file! NOT the recent item!
Turns out that double-clicking on the actual file instead of selecting it from the Welcome to Xcode window will help open the project as expected!
Also, after the first time open it with double-clicking the file, the window will be fixed by itself 🤷🏻‍♂️
In my case, the project was moved to my iCloud Drive without me noticing it.
If it happens to you too, just go to your Finder, locate the project and check if there is a cloud next to it. Just right click it and "Download now". Try again once the download is finished.
I was having this issue with Xcode 12. Opening Xcode, and selecting my project from 'Recent projects' list was causing Xcode to crash
My solution: I navigated to the folder and opened ProjectName.xcworkspace file, then it worked
If you're working with git, right click the project-name.xcodeproj > Show Package Contents, open the file project.pbxproj and check for conflict and resolve it.
Quit Xcode, then make a copy of the xcworkspace file (just in case). In finder, right-click the xcworkspace file and choose Show File Contents.
In that directory, open the xcuserdata directory and delete any contents. Start Xcode again and open the project.
In my case there was something wrong with the saved project state, so doing this resets the state and it opened normally.
I had the same error and none of the above helped me.
Solution that helped me: Create a new project, then without closing it, go to
File -> Open
and select your .xcworkspace file.

Copying / Reading files on iPhone

I am copying a SQLite file to the "Documents" directory of my iPhone/Simulator.
First I deleted the app off my phone and from the simulator and the app folder disappeared in "Application Support / iPhone " folder.
I made changes to the structure, deleted old version and copied new version to my "Resources" folder. Restarted my app which then copied the file back to the "Application Support / iPhone " fine.
The problem was though the file seemed to be cached as it would not execute queries on the new tables I added?
I have now fixed this by following the above steps BUT also renaming the database, but was wondering if anyone could shed some light on this?
Thanks
James
When changing a ressource I always "clean all target" and delete my App from the iPhone (device or simulator) , so I'm sure it will make the change.
However if your sqlite database is located in you ressources directory and not in document directory , you w'ont be able to do action such INSERT or ALTER TABLE because ressource directory is READ ONLY ;-) .
I advise you to move your sqlite db in Document folder when the app launch ;-) .
Hope it will help you.
Try a clean build. In Xcode: Build > Clean All Targets
Had to renamed the files as Cleaning the targets did not seems to work.