gpt4 book ai didi

ios - 应用程序在设备上崩溃但在模拟器上不崩溃

转载 作者:行者123 更新时间:2023-11-29 13:11:53 27 4
gpt4 key购买 nike

我正在开发一款通用应用程序。它在 iPhone 和 iPad 模拟器以及 iPhone 4S 上运行良好,但在 iPad 上崩溃。它是 iPad 上的 Split View,只有在打开某些 View 时才会崩溃。有些 View 工作得很好,没有问题,但在其他 View 上,当在主视图中选择特定行以在详细 View 中显示新 View 时,它会崩溃。如果我在 iPad 模拟器上运行有问题的 View ,它就可以正常打开。有什么想法吗?

这是我在主视图中选择其行时在详细 View 中显示问题 View 之一的方式。我在这个 View 中有一个搜索栏,搜索栏出现了,但 map View 没有。同样,一切都在 iPad 模拟器上运行良好。

else if (indexPath.row == 8)
{
RSFMipad *rsfm = [[RSFMipad alloc]initWithNibName:nil bundle:nil];
NSMutableArray *details = [self.splitViewController.viewControllers mutableCopy];

UINavigationController *detailNav = [[UINavigationController alloc]initWithRootViewController:rsfm];

[details replaceObjectAtIndex:1 withObject:detailNav];

KFBAppDelegate *appDelegate = (KFBAppDelegate *)[[UIApplication sharedApplication]delegate];
appDelegate.splitViewController.viewControllers = details;
appDelegate.window.rootViewController = self.splitViewController;
appDelegate.splitViewController.delegate = rsfm;
[appDelegate.splitViewController viewWillAppear:YES];
}

这是另一个,我从主视图的不同行加载另一个。这个不会立即填充详细 View ,而是在主视图中加载一个新的 TableView 。这也会导致 iPad 崩溃,但不会导致模拟器崩溃。

else if (indexPath.row == 6)
{
MemberBenefitsipad *benefits = [[MemberBenefitsipad alloc] initWithNibName:@"MemberBenefitsipad" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:benefits animated:YES];
}

日志中显示的错误错误是:

2013-06-12 14:36:54.267 KFBNewsroom[12125:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/ED63F1DA-31C8-4FC1-81D7-A3DCE3186C98/KFBNewsroom.app> (loaded)' with name 'MemberBenefitsipad''

编辑:我解决了这个问题。我只需要将 xib 文件放在包资源中。

最佳答案

这个问题可能是由您的 xib 文件的名称引起的。您没有名为 MemberBenefitsipad 的 xib。

如果你有不同的 xib 文件用于 iPhone 和 iPad 的 View Controller ,将文件命名为“MyXibFile~ipad.xib”(对于 iPad)和“MyXibFile~iphone.xib”对于 iPhone 以及当你尝试加载xib 仅使用“MyXibFile”字符串而不是整个名称,这样操作系统将根据设备加载所需的 xib。

还要注意资源和 xib 命名,因为模拟器不区分大小写 (MyXibFile = myxibfile) 但设备区分大小写 (MyXibFile != myxibfile)

关于ios - 应用程序在设备上崩溃但在模拟器上不崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17072887/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com