创建多个故事板iPhone / ipad,使用相同的viewcontroller,但iPhone storyboad可以运行,iPad错误信息(可以在ios模拟器上运行,但不能在我的ipadair上运行)。
这是我的代码:
NSBundle *resource = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"LibraryResource" ofType:@"bundle"]];
[resource load];
UIUserInterfaceIdiom userIdiom = [[UIDevice currentDevice] userInterfaceIdiom];
if (userIdiom == UIUserInterfaceIdiomPad) {
UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"Main_iPad" bundle:resource];
LibraryController* LibraryController = [mainStoryboard instantiateViewControllerWithIdentifier:@"LibraryController"];
[self presentViewController:LibraryController animated:YES completion:nil];
} else if (userIdiom == UIUserInterfaceIdiomPhone) {
UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:resource];
LibraryController* LibraryController = [mainStoryboard instantiateViewControllerWithIdentifier:@"LibraryController"];
[self presentViewController:LibraryController animated:YES completion:nil];
}
错误消息:
2014-03-04 14:24:25.515 AddLibrary[311:60b] Cannot find executable for CFBundle/CFPlugIn 0x157e0aad0 </var/mobile/Applications/184A78F9-1488-4C34-AD5C-10170067ACEA/AddLibrary.app/Library9898API Resource.bundle> (not loaded)
2014-03-04 14:24:25.522 AddLibrary[311:60b] Unknown class LibraryController in Interface Builder file.
答案 0 :(得分:0)
确保您已将文件包含在作为应用包的目标中。确保您已检查目标成员资格。
答案 1 :(得分:0)
将视图控制器添加到构建阶段。
再次清理并重建它。它应该有效。
如果没有,则重置模拟器,然后尝试
重命名视图控制器文件和类名,然后将其添加到项目中。
答案 2 :(得分:0)
iPadAir必须支持(64位),使用旧项目不要改变