How to Access an Xcassets Directory on the Filesystem

How to resolve Failed to read file attributes for /Users/path/myapp/Images.xcassets in Xcode?

I found out that my folder name is images.Xcassets, which Group name and Full Path is Images.xcassets. You should check your group name and full path in File inspector.

enter image description here

EDIT:

Here are two solutions:

1. Remove the group from Project Navigator (ALT+1), and add files back again (OPTION+ALT+A).

2. Click the folder icon from File Inspector (OPTION+ALT+1) and choose a new folder.

Create file reference to image in Images.xcassets using xcodeproj

It turns out Xcode handles the image references for you if you add an .xcassets file to your project.

Another thing I learned is that the .xcassets folder should be added to your target(s) as a resource with xcodeproj instead of a file reference. That way it will correctly show up under Project -> Target -> Build Phases -> Copy Bundle Resources.

e.g. target.add_resources([file_reference_to_xcassets])
instead of target.add_file_references([file_reference_to_xcassets])

Hopefully, this helps someone down the road :)



Related Topics



Leave a reply



Submit