可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm running into what seems to be common error, in that Xcode can't seem to find my 'Info.plist' file.
I've checked the answers to these two StackOverflow questions (Could not read from Info.plist and Objective C/Xcode error: The file “Info.plist” couldn’t be opened because there is no such file)...I am using a relative path, and the plist file is in the correct absolute location. The type and location are correct as shown in the image below:
My biggest concern is that this is now happening on multiple projects, including one I ran successfully just a few hours ago! Does anyone know how to solve this???
EDIT I've also tried reinstalling XCODE and replacing the plist file. Xcode still can't find 'info.plist'.
NOTE I wanted to add that this was for Xcode 6.2.X (I can't remember which version number exactly, but it was pre-Xcode 6.3.X).
回答1:
I also face the similar issue in xcode 7.0 but none of the above Solutions Worked for me, at last I get a chance to solved this issue
- Go to: App Target
- See the Identify and choose the Plist
See the screenshot also
Enjoy
回答2:
The solution for this particular instance of the error was “Info.plist couldn't be opened because there is no such file” was that I had deleted all of the files in the "Project Tests" folder, but was still had "Project Tests" listed under my targets. After deleting the "tests" target, the project built successfully.
回答3:
I faced similar kind of situation when I updated my XCode to 6.1. My project contained Info.plist but I got this error: "The file “Info.plist” couldn’t be opened because there is no such file."
Therefore, I looked up to the targets of my application which were: "App" & "AppTests".
I checked for the 'Packaging' field in 'Build Settings' tab.
Target: 'App' -> 'Build Settings' -> 'Packaging' -> 'Info.plist file(field)' - the location should be correct
Target: 'AppTests' -> 'Build Settings' -> 'Packaging' -> 'Info.plist file(field)' - the location must be something like this: 'AppTests/Info.plist'.Keep this field empty.Delete the location.
It seems that Apple is checking this location by default for finding Info.plist.
Clean & Build your project. It will work. Worked for me.
回答4:
For me, the anwser for this issue was:
1.Turn off Xcode
2.Go to ./Users/You/Library/Developer/Xcode/DerivedData
3.Delete everything from this folder
4.Run Xcode
5.Build&Clean
Xcode version: 6.4 (6E35b)
回答5:
In my case i was edited my xcode project folder name so that this is happened after changing folder's new name(Project -> Targets -> Build settings -> Packaging -> Info.plist name) then working fine.
回答6:
XCode 10
I know it's been a while, but I faced the same issue today, and the answers I've found weren't very clear for me, so I decided to make an instruction with screenshots.
1) First, open the right-hand panel in xcode and click on your .plist file:
2) Second, choose Relative to project
location on the right-hand panel and copy the link just below it:
3) Third, go to the main project settings, choose your target and click on the Build settings tab:
4) And finally, type Info.plist
in the search field, double-click on the existing path and paste the link you have copied earlier:
In the end, clean the project Shift
+ Cmd
+ K
and re-run.
回答7:
go to targets. right click on the test target. yourProjectTests and delete it
回答8:
As answered by @narner (answer marked as correct), yes it can make code work. But here is something better to solve the problem.
My suggestion is that instead of delete tests targets, better if we change the path of info.plist under tests target.
Simple steps:-
In project, click on the project file -> ProjectNameTests(under targets) ->Build settings->Packaging->Info.plist Here you change the path of file.
回答9:
One of the most weird issue that I have faced. In my case I do not have any file missing, I cleared the derived data, cleared the modular cache, cleaned the project multiple times, restarted my xcode, but nothing worked for me. At the end I restarted my computer with the only hope to resolve this issue which surprisingly worked for me!!!
回答10:
This is my first post, but I have been a dedicated student here for a while now.
For me the problem was a framework that I added. I know because when adding it, I got the problem and I test constantly during development on the simulator and I opened the simulator log and found the info.plist problem was solely with the framework I added. To double check, I deleted the framework and all references to it and tried building to the simulator again and everything went back to normal. So, after I tried everything that I read here and in other posts and not being able to fix the problem, I felt like throwing in the towel, but on my last attempt I did the following and it worked 24 hours after:
I removed references and completely deleted the framework in question from my Xcode project.
Opened Simulator, chose Simulator/Reset Content and Settings..
In Xcode, I did a Product/Clean and while holding alt down, did a Product/Clean Build Folder. I think if you do the latter of the 2, Product/Clean is unnecessary, but I was grabbing at straws
To add the framework back to the project, I chose the target/Build Phases and added a new Copy Files phase.
Made destination "Frameworks", TICKED "Copy only when installing" before adding the framework ( this part is in bold because it is the only thing that I changed from my original attempt ) added the framework to the copy files phase.
My blood pressure is back to normal now..
回答11:
Relocate the files by double clicking on this icon:
I had this issue too for the past couple hours. I had downloaded my github project from an earlier version. the search paths seem to have gotten confused and needed to be explicitly told where the files were located.
回答12:
Possible XCode 9 Update - I ran into this problem after I moved a bunch of files, including Info.plist, into a "Supporting Files" group. I've never had this error occur before XCode 9, so either it's something I did differently when moving/adding files to a group or it's something new w/ XCode 9 update.
When creating a group/folder based on selected files in XCode 9, it actually moves the files into a new folder in the Finder. Thus, my Info.plist file was moved and XCode/build/compile couldn't find it. I followed nivritgupta's idea above and it worked perfectly (select "Choose Info.plist File..." from Identity category in General build settings). I then selected the Info.plist file from its new location (that had been) "relocated" by XCode 9, and then my project built without an issue.
Side note: this also fixed the weird "Missing default-568h@2x" warning I started receiving at that same time. Two birds...
回答13:
This Worked for me:
- Go to the info.plist file on your Finder.
- Drag it and Add it to the Project Folder (Without Copying)
- Delete the Previous Reference (only the Reference, do not move to Trash)
- Try Running it again
Hope this helps someone :)
回答14:
Also you can check the target dependencies. It took me 1hr before realising that I have copied a UI test target for target A, but there was a dependency left. So the build required a file that was not mapped to target B, but only to A.
ui test for target B: dependency for target B and A
回答15:
First you need to check in your project folder whether info.plist is there or not.
If not then you need to copy info.plist from any other application into your project folder and add file in xcode. It will solve your problem.
回答16:
One other thing for consideration is to uncheck Localization for info.plist in utility bar,if you have checked it and then clear the project,the task is done!
回答17:
The answers above did not apply to my case.
This is what I have discovered.
Some weeks ago I dowloaded to my Downloads folder a github objective c library for my project. I then added that librabry with "Add Files to..." and the library worked just fine.
I regularly delete old files and folders from my Downloads. It happens that I deleted the folder that contained the objective-c library! Therefore, Xcode was complaining that it could not find a "Info.plist" that was in that folder. I went to the Trash bin, restored the folder and now it's all good!
Next time I add files to my folder I will make sure the files get copied into the project.
This Apple doc was of great help: https://developer.apple.com/library/ios/qa/qa1649/_index.html
Good luck
回答18:
Search "info.plist" using ctrl+sht+f in your project.
Tap on the results and you will find it as a field under Build Settings.
Ensure that it contains the correct path to your info.plist file as in the project hierarchy.
回答19:
While creating framework with enabled test cases, please ensure project should have two info.plist, one in the main project and other in tests.now you are getting this error because there may be missing of info.plist file either in project or in tests.
回答20:
do this only after reading all the other answers on this page
So basically the other answers are probably what you need. I've tried all of them and they didn't work. Not because they are wrong, but because I was simply looking at the wrong place.
Basically the error message simply states: The file "Info.plist" couldn't be opened etc etc. And I noticed all the answers on this page spoke about the plist file pertaining to the actual project (or it's test files, anyway). I double checked 1000 times and they were definitely in the right place.
That's when I realized the error message simply wasn't giving enough information, I have many info.plist files on my project!
So I simply compiled the code outside of xcode using command line like so:
xcodebuild -project project.xcodeproj -alltargets -configuration Debug
It gave me a much more detailed error message:
...
builtin-copyPlist --convert binary1 --outdir /Users/Shared/dev/ios/customer-ios/build/Debug-iphoneos/theApp.app --
theApp/Libs/STPopup/Info.plist
/Users/Shared/dev/ios/customer-ios/theApp/Libs/STPopup/Info.plist:0:
error: reading data: The file “Info.plist” couldn’t be opened because
there is no such file.
** BUILD FAILED **
The following build commands failed:
CopyPlistFile build/Debug-iphoneos/theApp.app/Info.plist theApp/Libs/STPopup/Info.plist
so it told me which plist file was problematic: Libs/STPopup/Info.plist
.. I searched for that file and indeed it turns out I was given a project that had missing libs:
回答21:
Not for info.plist but for another plist file I encountered the same problem. the reason for the error is I inadvertently copied the file to a folder, so it created a symlink. and When I remove the original file, this error is thrown. Deleting the symlinking file resolved the problem.
回答22:
Real Project Example with screenshots showing another way to solve this issue.
Using Swift 4 and Xcode 9.
1-look at the Xcode build error problem as shown in the picture in the 'Step 1 Visual Description' and it will tell you which Sub Folder in your Xcode Project the file belongs in. In my case it is the NVActivityIndicatorViewExample/Info.plist. Step 1 Visual Description
2-But you can also see where the Info.plist file is supposed to be by going to the 'Build Settings' section in your Xcode projects 'Target' area as shown in the picture in the 'Step 2 Visual Description'. When you're there look in the 'Packaging section' and click on the 'Info.plist file' row to have a pop up view show you which folder the file is supposed to be in. Step 2 Visual Description
3-Find your Info.plist file, open it up as a source code file by right clicking on it. Look at the Step 3 Visual Description for help.
4-Copy the code and delete the Info.plist file. Look at the Step 4 Visual Description for help.
5-The find the folder inside your project where the Info.plist file is supposed to go according to your build setting then right click on that folder and click on 'New File'. Look at the Step 5 Visual Description for help.
6-Make sure you're in the section for the kind of App (iOS in this case) you're building, go to resources and select 'Property List'. Look at the Step 6 Visual Description for help.
7-Type in "Info" as the file name with no extension, make sure the Group and Target are selected for your application and click "Create". Look at the Step 7 Visual Description for help.
8-Open the newly created Info.plist file as "Source Code", paste the previous XML code you copied from the deleted Info.plist file, save, and the run your app. (You can also build and clean the project if you want.)
回答23:
None of above-mentioned or other solutions did work for me. I found a solution after a couple of days searching.
ionic cordova platform remove ios
ionic cordova platform add ios
The reason I removed and added platform was I accidentally deleted some files under the ios folder. So, it brought the necessary files.