无法从Info.plist中读取

问题描述 投票:12回答:4

我复制了两个mac之间的项目。我收到了有关在Xcode 4 ProcessInfoPlistFile中找不到Info.plist的错误消息:

无法从'/Users/iamme/Documents/XCode/myapp/myapp/myapp-Info.plist'中读取数据:无法打开文件“myapp-Info.plist”,因为没有此类文件。

正如在Xcode can't open Info.plist -- error says "there is no such file"中所建议的那样,我去构建设置并放置正确的路径 - 我从Xcode中显示的文件路径复制和粘贴。

不幸的是,在编译时,我得到完全相同的消息。那么Info.plist路径还存储在哪里呢?

更新:我已按照建议放置相对路径但仍然收到错误(在活动日志中提供完整消息):

Process myapp/myapp-Info.plist
ProcessInfoPlistFile /Users/username/Library/Developer/Xcode/DerivedData/myapp-ancooijwpdbuzbbggnsalnhvckyr/Build/Products/Debug-iphonesimulator/myapp.app/Info.plist myapp/myapp-Info.plist
    cd /Users/username/Documents/XCode/myapp
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    builtin-infoPlistUtility myapp/myapp-Info.plist -genpkginfo /Users/username/Library/Developer/Xcode/DerivedData/myapp-ancooijwpdbuzbbggnsalnhvckyr/Build/Products/Debug-iphonesimulator/myapp.app/PkgInfo -expandbuildsettings -format binary -platform iphonesimulator -o /Users/username/Library/Developer/Xcode/DerivedData/myapp-ancooijwpdbuzbbggnsalnhvckyr/Build/Products/Debug-iphonesimulator/myapp.app/Info.plist
iphone xcode xcode4
4个回答
30
投票

这里不要使用绝对路径,使用相对于项目文件的路径。

Xcode项目的默认布局是:

CodeName.xcodeproj
CodeName/
    CodeName-Info.plist
    CodeName-Prefix.pch

从图形上看,在Finder中看起来像这样:

在这种情况下,您希望Info.plist文件为CodeName / CodeName-Info.plist。

在这里,我选择了Xcode项目,目标,并使用搜索栏来限制显示的设置:

最后,检查您的项目是否包含来自正确位置的info.plist文件。


10
投票

选择你的项目目标转到Build Phase,然后选择“Copy Bundle Resources”,你会看到红色突出显示的文件引用只是删除那些引用,再次添加所有这些文件。现在执行清理和构建。

要进行安全检查,只需在“构建设置”>“打包”部分中验证Info.plist文件路径。

警告:切勿在iOS项目的“复制包资源”构建阶段添加Info.plist。


1
投票

您可以通过here指定Info.plist文件


0
投票

如果更改文件夹名称,则必须在“构建设置”上进行更新。在Packaging下设置Info.plist文件路径。并确保该文件在您的项目中。

enter image description here


-1
投票

手动从此处选择新文件,将自动添加新路径

© www.soinside.com 2019 - 2024. All rights reserved.