69

I switched to Xcode 4 and loaded my project, which worked perfectly in Xcode 3. When I run it, I get an error that says:

The file “Info.plist” couldn’t be opened because there is no such file.

I have looked at the file in Xcode and it is there. So why can't it be opened?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Octavia Togami
  • 4,186
  • 4
  • 31
  • 49

13 Answers13

153

That the file exists in your Xcode project folder isn't enough. Have you verified the file is properly referenced in your application target's build settings so it's properly copied into the app bundle? It's not quite the same as a standard resource (ie, it's not made a member of the target in the set of target membership check boxes) but rather a build setting because of its importance in a properly-formatted bundle.

Navigate to the project (select it in the Project navigator), select the application target in the list of targets, then click the Build Settings tab. Under the Packaging section, make sure the "Info.plist File" is properly set to the location/file name.

Joshua Nozzi
  • 60,946
  • 14
  • 140
  • 135
  • 3
    I started getting this build error after I renamed the project from the "Project Explorer". This solution helped in fixing the problem. Thanks. – Vishal Chaudhry Feb 08 '14 at 08:32
  • 2
    Thankyou again (this is the second time i've done this), it always happens when I localise the file and it then moves it into en.lproj and therefore the previous reference cannot find it - inserting that in the path directory solved it – Rambatino Oct 24 '14 at 12:16
  • We have to make sure that we mention the correct path along with the correct name of the plist file. Great.. It works... – Pradeep Reddy Kypa Jul 13 '15 at 10:21
  • i know this is an old problem, but i've encountered it and the path to my info.plist (appname-info.plist) is absolutely correct in build settings under Project, Packaging. i've triple and quadruple checked it. Any other ideas? – mreynol Sep 22 '15 at 02:18
  • @mreynol Not without a lot more info. Like the exact error message(s), the exact settings you used (try screenshotting the build settings at all levels, not just "combined"), etc. Help us help you. – Joshua Nozzi Sep 22 '15 at 06:11
  • @JoshuaNozzi, please see below with some screen caps. not sure what else to provide at this point. maybe you see something i don't. – mreynol Sep 22 '15 at 18:55
14

I know it's been a while, but I faced the same issue, and the answers I've found weren't very clear for me, so I decided to make an instruction with a bunch of screenshots.

1) First, open the right-hand panel in xcode and click on your .plist file:

enter image description here

2) Second, choose Relative to project location on the right-hand panel and copy the link just below it:

enter image description here

3) Third, go to the main project settings, choose your target and click on the Build settings tab:

enter image description here

4) And finally, type Info.plist in the search field, double-click on the existing path and paste the link you have copied earlier:

enter image description here

In the end, clean the project Shift + Cmd + K and re-run.

joliejuly
  • 2,127
  • 1
  • 21
  • 24
13

go to targets. right click on the test target. yourProjectTests and delete it

amit gupta
  • 1,167
  • 12
  • 29
  • 12
    How does deleting the target help? It's like tellibg a user with a build error to delete their project, as if that itself is the solution. I hope you never go into medicine... – Joshua Nozzi Mar 16 '15 at 20:50
  • same as Joshua, this advice is like killing the patient when they have a cold. I don't understand why this answer has so many upvotes. – Alice Rocheman May 02 '23 at 14:16
11

Xcode 8

Select the project file in the left pane. Then open the general tab and they have added a nice button that lets you select the file. (You may have to add it into your project structure as well)

enter image description here

quemeful
  • 9,542
  • 4
  • 60
  • 69
10

For me the problem was that some of the .storyboard files had different deployment targets after a merge. Fixed it by setting all the storyboard files to use "Project Deployment Target". enter image description here

Genki
  • 3,055
  • 2
  • 29
  • 42
8

For me this happened as a result of enabling localization of the plist file (to give language specific identifier of the app on springboard).

In targets>build settings>packaging>info.plist file key i changed the path from AppName/AppName-info.plist to AppName/Base.lproj/AppName-info.plist and everything worked as expected.

Remember, its lproj as in a small L and not a capital I.

Hope this helps.

AceN
  • 771
  • 10
  • 18
  • 1
    this might allow you to compile and run, but it doesn't look like it actually uses the localized info.plist... – royherma Sep 26 '16 at 03:41
  • i dropped the idea of using localized app name for a while. – AceN Dec 27 '16 at 21:50
  • I think you guys have mistaken info.plist with infoPlist.strings. I just had the same problem and I realized my mistake and tried using the infoPlist.strings files. There were no bad surprises. It works. – Michael Shang Jan 06 '17 at 23:27
1

under Xcode 4.6 if the appname-Info.plist is not visible under project -> target/info, go to summary tab and it will ask for the appname-Info.plist file. Select the correct file from the suggestion(s).

1

Under Targets>Packaging>Info.plist file, make sure that the file path is correct.

PWiggin
  • 956
  • 2
  • 12
  • 24
0

In my case, the file was there, but malformed. If you recently edited your Info.plist in a text editor, undo that change, and retry without breaking the markup validity.

jorisw
  • 875
  • 1
  • 11
  • 17
0

For me the issue was that the error was referring to the Info.plist from a library I was using, not the actual .plist file from the project.

Maybe this will help someone in the future.

Adrian
  • 19,440
  • 34
  • 112
  • 219
  • How were you able to tell, and what did you end up doing to solve it? Mine is so generic I can't tell which `Info.plist` it's talking about. Right Click -> Open in Finder on the error brings me to whatever I had open before in Finder, since the file doesn't exist. – RebelFist Jan 28 '16 at 18:43
  • @RebelFist: I had the Info.plist file inside my project library I was using red. So my suggestion is to look for red files in your project. – Adrian Jan 29 '16 at 17:59
  • Thanks for the response! It ended up being a folder that was pointed to the wrong place even though all of the items inside of it were pointed to the right one. So everything looked good, but when we built we got an error > – RebelFist Jan 29 '16 at 20:16
0

In my case one of the key was missed out while adding ATS compliance flag

<key>NSAppTransportSecurity</key>

Instead of the correct one as below

<true/>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>some-service1.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <false/>
        </dict>
        <key>some-service2.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <false/>
        </dict>
    </dict>
</dict>

I was having this

<dict>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>some-service1.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <false/>
        </dict>
        <key>some-service2.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <false/>
        </dict>
    </dict>
</dict>

Although some of the online XML Validators did say the XMLs are correct, (which was not), I used

plutil filename.plist

going to the directory where plist file is present (from terminal) and got to know the exact line number that had issues Reference :(https://stackoverflow.com/a/32494850/5438240)

Naishta
  • 11,885
  • 4
  • 72
  • 54
0

This problem happened the same to me,this happened when I merge the project from other project,some project setting was difference in above two, open the info.plist file in Text Edite,solve the conflcted then save it,everything goes well!

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/21791972) – Pankaj Makwana Dec 28 '18 at 06:41
  • Info.plist can only recognize the statement block in the xml type format. When the file conflicts, some special strings such as ===, >>>, <<< are added to the info.plist file, causing the plist file to be unrecognized and the special is removed. Symbols are all right – user8005634 Dec 29 '18 at 08:43
0

for react native, go to ios/{project name}/Info.plist open it in vs code or any other and check that all the key and strings must be inside the in most cases! You must have changed it for installing the lib and done some mistakes in it.

Ankit
  • 411
  • 4
  • 4