xcode 无法从 Info.plist 读取
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9880184/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not read from Info.plist
提问by user310291
I copied a project between 2 macs. I got the error message about Info.plist not found in Xcode 4 ProcessInfoPlistFile:
我在 2 台 Mac 之间复制了一个项目。我收到有关 Info.plist not found in Xcode 4 ProcessInfoPlistFile 的错误消息:
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
回答by Steven Fisher
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:
从图形上看,这在 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 项目、目标,并使用搜索栏来限制显示的设置:
Finally, check that your project is including the info.plist file from the right location.
最后,检查您的项目是否包含来自正确位置的 info.plist 文件。
回答by Anshul Sharma
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.
选择你的项目目标去构建阶段,然后选择“复制捆绑资源”,你会看到红色突出显示的文件引用只是删除这些引用,再次添加所有这些文件。现在执行清理和构建。
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。
回答by Md Imran Choudhury
回答by Neb?
回答by xuechuan mi
Choose new file from here manually, a new path will be added automatically
从这里手动选择新文件,将自动添加新路径