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?
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:
Clean build folder before each try you make to fix this (Command+Option+Shift+K), just in case
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
If you're building multiple targets, be sure to check if each has a valid .plist, not just the main one.
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)
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!)
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
I accidentally hit discard all changes without having "committed". It seems to have wiped all the info from the app when I open Xcode but when I go to the project file all the .swift files and icons are still there. I have tried what the other posts have said about all of the git commands but this seems to be different. Since discarding changes brought me to the starting part of the project but I still have all the files from before is there an alternative way I can restore my program?
Can't you just re-add the files in Xcode?
Xcode > File > Add files to...
... and reselect the .swift files / icons that you mentioned that are still there.
I am a newbie. I bumped into a few problems in the course of developing iOS swift app. with your explanation, I will learn how to use the best practices.
here my questions I wanted to know the reasons and use the simple ways to solve:
I accidentally deleted the main.storyboard file. However, I got back up. I thought to start fresh. I delete the project and created a new one with exact same name. I deleted the new main storyboard file in it and copy the old main story file as well as the other files into Top level folder (App folder). I rebuilt it and it run.
here my questions:
I see other samples, I notice the Main storyboard file is inside Base.lproj folder. But in my project, the main storyboard file is not in it when open in Xcode v7.3. I open the App Folder in DeskTop, I dont see main storyboard file in Base.lproj. But this file is in App Folder. is this ok?
I run it a couple of time, I don't see Tests folder like ProjectNameTests as well. Is this ok?
If I manually move the main storyboard file into Base.lproj, it will have compiling issue.
is this way of restoring files ok? Copy the old files into the Top level folder ok?
What will be the correct ways to handle if I have backup for project.
Apprciate your help on this matter.
Thanks
I am looking to .gitignore my plist file found within a subdirectory within my project. When I ignore individual files at the root level where .gitignore is located I have no problems with the exclusion, but when I try to exclude files within the a subdirectory I can't seem set up the proper way to exclude this and my file still appears. I think what is throwing me off the most is the way that my Xcode projects appear in my finder compared to my Xcode program. In Xcode, my .plist appears within a Supporting Files folder. Once would assume that this would mean my gitignore request would be /app-name/Supporting Files/Info.plist, but in the finder, there is no Supporting Files folder, just Info.plist.
Any advice as to what I should do?
Should my .gitignore look like:
facebook-login-template/Info.plist
or
/facebook-login-template/Supporting Files/Info.plist
or should it be something else?
I think you are looking for this:
*Info.plist
If you only want to avoid the one inside "facebook-login-template", it should work with
facebook-login-template/Info.plist
but remember you have to reset the file on git if you've already tracked it.
I was trying to merge branches and it resulted in the error "Unable to open project… cannot be opened because the project file cannot be parsed". I then tried to take the advice of other stackoverflow responses (namely to edit the file to remove the corruption), but was unable to edit the file. It appears that this is actually a directory, so maybe the structure of this changed with version 4.4 of xcode and since the response to Unable to open project... cannot be opened because the project file cannot be parsed was written.
I then tried to restore myProject.xcodeproj from my time machine backup. This does not work because it says that I don't have permission to access myProject.xcodeproj. I tried to change the permission of that directory, but that did not help.
I closed and reopened xcode. Now the error is:
Project ...xcodeproj cannot be opened because it is missing its project.pbxproj file.
How can I fix this problem in xcode version 4.4? Can it be restored from the previous snapshot or archive or version in xcode. Can it be restored with time machine. I would like to avoid rebuilding the entire project.
The simplest thing to do is probably to
Checkout myProject.xcodeproj from source control. This will contain the changes that were causing you to be in conflict last time.
Redo the project changes that you made since the last time you committed to source control
commit/push to source control.
In the future, when you get a conflict in the project file, take a look at myProject.xcodeproj/project.pbxproj. Often it's just new files in the project that have been added at the same place. In this case you just need to delete the conflict metadata and resolve the conflicted state.
In the end, what I had to do was
'cp -R ...TimeMachineBackup/myProject.xcodeproj ...myProjectArea/myProject.xcodeproj'
Then I had to do the following in myProjectArea:
git reset --merge
This allowed me to open the project and switch branches back to my main branch.
not a pleasant experience
Another way this can happen is if you've been using sudo for some reason with pods or the editor - if the file exists under yourApp.xcodeprojectroj directory but xcode is complaining it can't find it - Go to your project root and do:
sudo chown -R yourusername:staff ./*
For others looking at this issue, the cause in my case turned out to be, that the "conflict text" from a git merge had crept into the actual file:
<<<<<<< HEAD
F0FDA2D61B99EB80007DB99D /* Aptron-mCollegix.xcassets */,
=======
F08CFAAA1BC1E9EE00A5B6F5 /* Aptron-mCollegix.xcassets */,
>>>>>>> hotfix/Column_Text_Cut-off
opening the project.pbxproj in a text editor made the fix easy.
I found my own solution to this issue.
The cause of the bug is that the .xcodeproj file is missing its containing pbxproj file, right? This is usually present when you right click your .xcodeproj file and click 'Show Package Contents'. However, in your own case, it's been deleted, through some mistake or other of git versioning.
As you can't really generate a .pbxproj file, the solution I found was to go to the original project folder location, which I had used to create the repository. To be honest, you could probably simply create a new project also, as long as it has the same bundle identifier and such! As this project's xcodeproj file will correctly contain a .pbxproj file, replacing the files in the XCode environment with your own project's files will allow the .pbxproj file to update based on these files.
Therefore, after opening this original project folder (/new project folder), in the XCode environment, I then removed all the files within the project, and replaced them with the corresponding files from my project which I was unable to open the xcodeproj file of. I had to fix a few resulting bugs here and there, stuff involving build phases and such not lining up, given you've just copied in a bunch of new files. But after fixing a few small errors, the same project in this new location was eventually able to run no problem!
Finally, I took this successfully running version of the project, and copied in all the files, .xcodeproj file, project folder, test files and all, into the original repository location, deleting the files from the repository before hand to avoid confusing overwriting of files (you can cut and paste the old repository files to a new location if you want to be safe, and don't fancy deleting them!). Then open the project in XCode from the repository location, build and run it on your simulator/device to make sure everything lines up (and fix any small bugs you may need to), and voila! Your project is now able to be committed, pushed, and ran!
This isn't the cleanest solution, and you may have to do similar things across various branches if they've all been corrupted. However, if you don't have access to a Mac time machine, and the other solutions aren't working for you, this is possibly the most straight forward way of having a working .pbxproj file again!
Oh, and I removed the .pbxproj from my gitignore. I'm not sure if it's actually find to have it in your gitignore or not, but I'd recommend doing your own research on that subject, I'm not certain myself!
Good luck!
I was able to get this working without commandline stuff like this:
Go to Time Machine drive in Finder.
Navigate to desired backup.
Drag it to where I want it. This will complain about not having permission to access the .pbxproj
Right-click the xcodeproj you just dragged out, select "Show Contents".
Right-click the xcodeproj in the Time Machine backup folder, select "Show Contents".
Drag the .pbxproj you see inside to the destnation you just created with the drag in #3.
Now it should work.
It seems you can generate the file again with:
swift package generate-xcodeproj
although you could see this message:
warning: Xcode can open and build Swift Packages directly. 'generate-xcodeproj' is no longer needed and will be deprecated soon.
generated: ./BokenEngine.xcodeproj
with xcodebuild > 13.4.1:
xcodebuild -version
Xcode 13.4.1
Build version 13F100
If anyone wants to find the missing project.pbxproj file then try opening the .xcodeproj with some code editor and you will find the file there. And note that i had backup of my application in my other pc so i found that file there so you mist have backup of your project somewhere in order for this to work.
In my case the issue was that there were actually 2 folders with .xcodeproj suffix
The actual one was located in MyApp/MyApp.xcodeproj
Somehow another one with the same name MyApp.xcodeproj got added to root folder, with the following contents:
project.xcworkspace/contents.xcworkspacedata
project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
So deleting this corrupt(?) xcodeproj solved the issue.