如何配置我的目标以在 Xcode 中使用特定的 Info.plist?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12839941/
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
How can I configure my target to use a specific Info.plist in Xcode?
提问by jchatard
I have an Xcode project with many, many targets (iPhone, iPad, OS X).
我有一个 Xcode 项目,有很多很多目标(iPhone、iPad、OS X)。
I need to have different Info.plist files for each of my targets.
我需要为每个目标设置不同的 Info.plist 文件。
For iOS, I don't run into any issue, everything builds fine. But for OS X, I get the following message:
对于 iOS,我没有遇到任何问题,一切都很好。但是对于 OS X,我收到以下消息:
No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting
In the OS X target build settings I've entered:
在我输入的 OS X 目标构建设置中:
Info.plist File: /MyApp/Resources/Info-osx.plist
How can I get around this issue? Is there something I did forgot to specify?
我怎样才能解决这个问题?有什么我忘记指定了吗?
Thanks.
谢谢。
采纳答案by jchatard
Have you set NSPrincipalClass in the info.plist for the OS X target? The NSPrincipalClass is the main class used to start the OS X app.
您是否在 info.plist 中为 OS X 目标设置了 NSPrincipalClass?NSPrincipalClass 是用于启动 OS X 应用程序的主类。
by rckoenes in the last comment
由 rckoenes 在最后一条评论中
This was the solution.
这就是解决方案。
回答by rckoenes
The path the info.plist in the build settings is relative in you project source.
If you remove the first /
it should work.
构建设置中的 info.plist 路径在您的项目源中是相对的。如果您删除第一个/
它应该可以工作。
Also don't include the info.plist
in the target, when you compile your project it is generated in the app for you.
也不要info.plist
在目标中包含,当您编译项目时,它会在应用程序中为您生成。