xcode 无效的 info.plist - 将应用程序发送到应用程序商店时的 UIMainStoryboardFile 或 NSMainNibFile
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16082955/
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
Invalid info.plist - UIMainStoryboardFile or NSMainNibFile when sending an app to app store
提问by bldysnw
While sending an app to the app store I received a message stating:
在向应用商店发送应用程序时,我收到一条消息:
"Invalid info.plist: the info.plist may contain either UIMainStoryboardFile or NSMainNibFile, but must not contain both keys"
After googling around it seems the consensus is to set the "main nib file base name" to "MainWindow
" and also to set the "main storyboard file base name" to "MainStoryboard_iPAd
". Both options we already have.
在谷歌搜索之后似乎共识是将“主nib文件库名称”设置为“ MainWindow
”,并将“主故事板文件库名称”设置为“ MainStoryboard_iPAd
”。我们已经有了这两种选择。
The app is designed to run on both iPad and iPhone and the app contains two storyboard files, one for ipad and one for iphone. I cannot find any visible .nib or .xib to manipulate even if I found the correct answer.
该应用程序旨在在 iPad 和 iPhone 上运行,该应用程序包含两个故事板文件,一个用于 ipad,一个用于 iphone。即使我找到了正确的答案,我也找不到任何可见的 .nib 或 .xib 来操作。
Does anyone have any hints on how to work around/fix this so the app will send?
有没有人对如何解决/修复此问题有任何提示,以便应用程序发送?
Thanks heaps!
谢谢堆!
回答by olivaresF
Unfortunately, @verbumdei's answer did not work for me.
不幸的是,@verbumdei 的回答对我不起作用。
I was trying to turn an iPhone-only project to Universal in iOS 7 and it wasn't working. The iPad's storyboard wasn't being read.
我试图在 iOS 7 中将一个仅限 iPhone 的项目转换为 Universal,但它不起作用。没有人阅读 iPad 的故事板。
What happened was that Xcode added a key to my .plist that was "Main nib file base name (iPad)". I had to delete that key and add "Main storyboard file base name (iPad)", then set the filename to my storyboard's (i.e. Storyboard-iPad.storyboard).
发生的事情是 Xcode 向我的 .plist 添加了一个键,即“主 nib 文件基本名称(iPad)”。我不得不删除那个键并添加“主故事板文件基本名称(iPad)”,然后将文件名设置为我的故事板(即 Storyboard-iPad.storyboard)。
回答by Valent Richie
As the message suggests, you should not have both UIMainStorboardFile and NSMainNibFile set in your Info.plist file. I would suggesy you remove the NSMainNibFile entry.
正如消息所暗示的那样,您不应在 Info.plist 文件中同时设置 UIMainStorboardFile 和 NSMainNibFile。我建议您删除 NSMainNibFile 条目。
Since you have two storyboards, one for iPad, and one for iPhone, you can set them as the Main Storyboardseparately in the Summarytab of your project:
由于您有两个故事板,一个用于 iPad,一个用于 iPhone,您可以在项目的“摘要”选项卡中将它们分别设置为主故事板:
回答by watr
回答by Newkie
Check info
-> custom IOS target properties
检查info
->custom IOS target properties
Check Main nib file base name(iPhone/iPad)
or Main Storyboard file base name(iPhone/iPad)
检查Main nib file base name(iPhone/iPad)
或Main Storyboard file base name(iPhone/iPad)
If not exist, add them and write your base file name.
如果不存在,请添加它们并写入您的基本文件名。
It works for me.
这个对我有用。
回答by Edson Filho
For those with problems, I solved without creating a new key, just removed the (iPad) from the existing key
对于那些有问题的人,我没有创建新密钥就解决了,只是从现有密钥中删除了(iPad)
In Main Interface I selected the Storyboard, saved, cleaned the project and voila
在主界面中,我选择了 Storyboard,保存,清理了项目,瞧
回答by Daniel Danielecki
As of Xcode 11 go to Info
-> Custom iOS Target Properties
-> Find Main nib file base name (iPad)
and leave value for this key empty. Also, in General
-> Deployment Info
-> Main interface
your value should be empty.
从 Xcode 11 开始,转到Info
-> Custom iOS Target Properties
-> 查找Main nib file base name (iPad)
并将此键的值留空。另外,在General
-> Deployment Info
->Main interface
你的值应该是空的。
回答by S1LENT WARRIOR
None of the above solutions worked for me.
Therefor what I did was that i added a storyboard
property to the AppDelegate
and set its value in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Below is the code for this:
AppDelegate.h
以上解决方案都不适合我。
因此,我所做的是我向 中添加了一个storyboard
属性AppDelegate
并在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
下面设置了它的值,代码如下:
AppDelegate.h
@property (strong, nonatomic) UIStoryboard* storyboard;
AppDelegate.m
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { // is iPad
self.storyboard = [UIStoryboard storyboardWithName:@"Storyboard_ipad" bundle:Nil];
} else {
self.storyboard = [UIStoryboard storyboardWithName:@"Storyboard_iphone" bundle:Nil];
}
self.window.rootViewController = [self.storyboard instantiateInitialViewController];
[self.window makeKeyAndVisible];
return YES;
}
回答by Amit Limje
By default Xcode creates 'Main nib file base name (iPad)' in info.plist file and assign it with name of your iPad storyboard.
默认情况下,Xcode 在 info.plist 文件中创建“Main nib file base name (iPad)”,并为其分配 iPad 故事板的名称。
Here is resolution Open Info.plist file-> delete 'Main nib file base name (iPad)' and add another key with name 'Main storyboard file base name (iPad)' and assign it with name of your iPad storyboard file i.e. Main_iPad don't provide extension.
这是分辨率打开 Info.plist 文件-> 删除“主要 nib 文件基本名称(iPad)”并添加另一个名称为“主要故事板文件基本名称(iPad)”的键,并为其分配 iPad 故事板文件的名称,即 Main_iPad don '不提供扩展。