Xcode can't open Info.plist — error says “ther

2019-01-21 21:40发布

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?

12条回答
手持菜刀,她持情操
2楼-- · 2019-01-21 22:02

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

查看更多
爷、活的狠高调
3楼-- · 2019-01-21 22:06

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.

查看更多
4楼-- · 2019-01-21 22:11

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

查看更多
Rolldiameter
5楼-- · 2019-01-21 22:12

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.

查看更多
Rolldiameter
6楼-- · 2019-01-21 22:13

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.

查看更多
男人必须洒脱
7楼-- · 2019-01-21 22:13

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)

查看更多
登录 后发表回答