无法从Info.plist中读取

时间:2023-02-05 14:20:19

I copied a project between 2 macs. I got the error message about Info.plist not found in Xcode 4 ProcessInfoPlistFile:

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

could not read data from '/Users/iamme/Documents/XCode/myapp/myapp/myapp-Info.plist': The file “myapp-Info.plist” couldn’t be opened because there is no such file.

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

As advised in Xcode can't open Info.plist -- error says "there is no such file" I went to build settings and put the right path - which I copied and pasted from file path shown in Xcode.

正如在Xcode中所建议的那样无法打开Info.plist - 错误说“没有这样的文件”我去构建设置并放置正确的路径 - 我从Xcode中显示的文件路径复制和粘贴。

Unfortunately when compiling I got exactly the same message. So where else is Info.plist path stored?

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

Update: I have put relative path as advised but still get the error (give full message in activity log):

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

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

2 个解决方案

#1


29  

Don't use an absolute path here, use a path relative to your project file.

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

The default layout for Xcode projects is this:

Xcode项目的默认布局如下:

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

Graphically, that looks like this in Finder: 无法从Info.plist中读取

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

In this case, you'd want Info.plist File to be CodeName/CodeName-Info.plist.

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

Here, I've selected the Xcode project, target, and used the search bar to limit the settings being shown:

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

无法从Info.plist中读取

Finally, check that your project is including the info.plist file from the right location.

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

无法从Info.plist中读取

#2


10  

Select your project Target go to Build Phase, then select "Copy Bundle Resources", you would see red highlighted file references just remove those references, again add all those files. Now perform clean and build.

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

For a safety check just verify the Info.plist file path in "Build Settings"> Packaging section.

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

Warning : Never add Info.plist in "Copy Bundle Resources" build phase in your iOS project.

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

#1


29  

Don't use an absolute path here, use a path relative to your project file.

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

The default layout for Xcode projects is this:

Xcode项目的默认布局如下:

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

Graphically, that looks like this in Finder: 无法从Info.plist中读取

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

In this case, you'd want Info.plist File to be CodeName/CodeName-Info.plist.

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

Here, I've selected the Xcode project, target, and used the search bar to limit the settings being shown:

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

无法从Info.plist中读取

Finally, check that your project is including the info.plist file from the right location.

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

无法从Info.plist中读取

#2


10  

Select your project Target go to Build Phase, then select "Copy Bundle Resources", you would see red highlighted file references just remove those references, again add all those files. Now perform clean and build.

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

For a safety check just verify the Info.plist file path in "Build Settings"> Packaging section.

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

Warning : Never add Info.plist in "Copy Bundle Resources" build phase in your iOS project.

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