Jaqueline
Jaqueline

Reputation: 485

Reading data: The file "Info.plist" couldn't be opened because there is no such file

After cloning my Github repo, everything runs fine except the build fails because of this error "Reading data: The file "Info.plist" couldn't be opened because there is no such file."

I have tried every possible solution I could find, including deleting the file and creating a new one, deleting it from the Copy Bundle Resources, adding it to the Build Settings, etc. I have followed these posts among others on all of the solutions but nothing has worked. Error: The file “Info.plist” couldn’t be opened because there is no such file, Info.plist Utility Error: "Info.plist couldn't be opened because there is no such file"

I would really appreciate someone's help in finding a solution to this problem, and if you need any more information, please let me know.

Edit: Also for some reason when I looked in the project it's not the newest version that I had committed to Github. I was wondering how I can clone an exact commit? I was trying to look at this post but I'm not exactly sure where to find the remote address?

Upvotes: 4

Views: 3220

Answers (3)

l'L'l
l'L'l

Reputation: 47302

The following applies to the question, comments and answers here:

Info.plist should be capitalized — if not it could easily explain your problem.

NOTE: Several comments and answers are using lowercase info.plist, this just adds fuel to the fire. It's best to be specific (especially when it comes to this), because that minor detail can make a huge difference.

The answer awarded the bounty is absolutely false information. The following excerpt comes directly from the documentation previously linked:

Important: In the sections that follow, pay attention to the capitalization of files and directories that reside inside a bundle. The NSBundle class and Core Foundation bundle functions consider case when searching for resources inside a bundle directory. Case mismatches could prevent you from finding your resources at runtime.

Source: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW1

Upvotes: 1

Asperi
Asperi

Reputation: 258601

Update: Although it is not important how the info plist file is named physically in your project, because Xcode renames it always into Info.plist during product bundle creation phase, but to avoid confusing among community, let's assume that your info plist is named Info.plist.

Check the followings:

1) Is Info.plist present in file system after clone?
2) Is correct related path is set for Info.plist in project Build Settings (INFOPLIST_FILE tag)?
3) Is Info.plist file not damaged - opened by Xcode as a document (Info tab in project settings should show it as well)?

Note: Info.plist should not be added in target's Resources, it is copied by Xcode from mentioned above INFOPLIST_FILE (and renamed if needed into Info.plist!)

Upvotes: 1

Rad'Val
Rad'Val

Reputation: 9251

It's going to be pretty difficult to debug this without having a look at your project, if all fails you might consider making a copy, remove all source files and share that shallow copy on a public repo.

Otherwise, on top of what @Asperi had already said, be sure to:

  1. Clean build folder before each try you make to fix this (Command+Option+Shift+K), just in case
  2. Open the build logs (see below) and using the search (Command+F) look of an entry that starts with ProcessInfoPlistFile. Check if there's something wired with the path there, check if the file pointed by that path is missing, if it has the right project name etc
  3. If you're building multiple targets, be sure to check if each has a valid .plist, not just the main one.
  4. Open yourprojectname.xcodeproj/project.pbxproj in a plain text editor (e.g. write open yourprojectname.xcodeproj/project.pbxproj in terminal) and search for Info.plist, be sure that each entry has a valid path (the path specified there actually exists)

enter image description here

Upvotes: 1

Related Questions