4

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?

Jaqueline
  • 465
  • 2
  • 8
  • 25
  • [HERE](https://stackoverflow.com/a/32991851/3146021) to know the remote address. Get the newest commit, clean and build project again. Try to this first and let me know if still have error – Trai Nguyen Nov 17 '19 at 04:36
  • @TraiNguyen how would that look for example typing in a commit? – Jaqueline Nov 17 '19 at 06:17
  • unsure about your question but as i know, should go to the web contain your source code, like github, bitbucket, ... , check how many branch you have, and see what is newest commit of each branch, it so easy for looking than in terminal - i think :) – Trai Nguyen Nov 17 '19 at 07:30
  • Try to remove `$(SRCROOT)/` from Bundle Settings (`INFOPLIST_FILE`) – ArtFeel Nov 20 '19 at 17:01
  • Out of curiosity, when you say this doesn't work, are you talking about when you run this from a clone in a different directory? Or to put another way, if you copied your project to another directory, will it work or fail? – Mobile Ben Nov 20 '19 at 22:55
  • @MobileBen I mean that when I cloned the project from GIthub, I would get this problem and nothing I tried would work. – Jaqueline Nov 21 '19 at 00:08
  • When you clone it, are you cloning to a new directory or to one with the *exact* same path? I'm asking this because there is a chance you have a hard coded path which is doing it (which is why I'm asking these q's). Also if you click on your target in the Project Navigator and click on the Info section ... does it show your info plist information? – Mobile Ben Nov 21 '19 at 03:42
  • Did you check the path of info.plist in all your target? ex.: Test, Pods..... – christian mini Nov 22 '19 at 07:27
  • 1/ check your branch: git branch -> is it the one you'd expect, 2/ search your plist file: git ls-files | grep plist -> is it were you expect it to be? How does that compare with the build message, is it the same path? – Alex Nov 22 '19 at 12:08

3 Answers3

1

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!)

Asperi
  • 228,894
  • 20
  • 464
  • 690
  • That is correct. It is not damaged, everything shows as it should. The file shows up in the file system (as in the project like a file in Finder with all the others), the path is correct in the Build Settings, and it's not in the Resources (is that the Resources Tag?) – Jaqueline Nov 16 '19 at 07:34
  • is it public repo? can you give a link? – Asperi Nov 16 '19 at 07:35
  • Unfortunately I cant. It's private. I'll be more than happy to give you any information you need. I didn't have this problem before but I had to delete Xcode to get storage to update to Catalina, and after that when I tried to clone the project I don't get the newest commit (by like 6 months) and I get this problem. – Jaqueline Nov 16 '19 at 07:37
  • It should be `Info.plist` not `info.plist`. – l'L'l Nov 23 '19 at 04:24
1

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

Rad'Val
  • 8,895
  • 9
  • 62
  • 92
1

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

l'L'l
  • 44,951
  • 10
  • 95
  • 146
  • It does not matter how the project info.plist file is named if you use `INFOPLIST_FILE` and not copy it manually. Xcode will rename it automatically into Info.plist during build. – Asperi Nov 24 '19 at 08:12
  • @Asperi: **It does matter as it states that the case is important directly in the documentation.** if you solely rely on a tool to correct your mistakes that’s bad practice. – l'L'l Nov 24 '19 at 23:59