iOS 11.3 和 Xcode 9.3 导致 Obj-C 应用程序启动失败 [英] iOS 11.3 AND Xcode 9.3 causing Obj-C app launch failures

查看:25
本文介绍了iOS 11.3 和 Xcode 9.3 导致 Obj-C 应用程序启动失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这是一个奇怪的...我们有一个用 Obj-C 编写的应用程序,在任何人更新到 iOS 11.3 之前它运行良好.11.3 更新打破了它……但是使用 Xcode 9.3 和新编译器,我们在任何和所有设备上都会遇到相同的错误.因此,Apple 似乎破坏了 SDK 中的某些内容.

So this is an odd one... we have an application that is written in Obj-C and prior to anyone updating to iOS 11.3 it ran fine. The 11.3 update broke it... however with Xcode 9.3 and the new compiler we get the same error on any and all devices. So it appears that Apple broke something in the SDK.

出于同样的原因,如果他们真的破坏了 SDK 中的某些内容,那么每个人似乎都会遇到这个问题.所以我求助于您,SO 智囊团,帮助我解决这个问题!

By the same token, it seems likely that if they had actually broken something in the SDK then EVERYONE would be having this issue. So I turn to you, the SO braintrust, to help me figure this out!

注意:非常清楚:这是一个用 Obj-C 而不是 Swift 编写的较旧的应用程序,并且只维护了一段时间.

所以有问题的代码块很简单:

So the offending block of code is very simply this:

- (UINavigationController *)controllerForCategories: (NSArray *)categories titled:(NSString *)title
{
    DocumentViewController *dc = [[DocumentViewController alloc]initWithCategories:categories titled:title];
    UINavigationController *nc = [[UINavigationController alloc]initWithRootViewController:dc];
    [self addChildViewController:nc];
    // ERROR HAPPENS ON THIS ^^ LINE
    [nc didMoveToParentViewController:self];
    [self.contentPanel addSubview:nc.view];
    nc.view.frame = self.contentPanel.bounds;
    return nc;
}

现在根据 Apple 文档,这应该没问题.如果我们重写了 addChildViewController() ,那么我们可能会遇到问题,但我们没有,我们只是调用了该方法.名为nc"的参数是一个扩展 UIViewController 的 SDK 类,因此它是相关方法的有效参数.但是,在 11.3(或使用 Xcode 9.3 的所有 iOS 版本上,我们每次在任何设备上启动时都会收到此错误:

Now according to the Apple docs, that should be fine. If we had overridden addChildViewController() then we might have an issue, but we didn't, we're just calling the method. The argument, named 'nc', is an SDK class that extends UIViewController, so it's a valid argument to the method in question. However, on 11.3 (or on all iOS versions with Xcode 9.3, we get this error EVERY TIME we launch, on any device:

2018-04-25 14:42:18.792216-0700 Steri-Vac GS[1090:855706]-[MasterNavigationViewController _viewControllerSubtreeDidGainViewController:]:无法识别的选择器发送到实例 0x101210100 2018-04-25 14:42:18.792662-0700 Steri-VacGS[1090:855706] * 由于未捕获的异常而终止应用程序'NSInvalidArgumentException',原因:'-[主导航视图控制器_viewControllerSubtreeDidGainViewController:]: 无法识别的选择器发送到实例 0x101210100'* 第一次抛出调用堆栈:(0x186c4b164 0x185e94528 0x186c58628 0x1905c6188 0x186c50b10 0x186b35ccc 0x19029a904 0x29c0x100a4941c 0x100a48bec 0x190205a00 0x1902055d8 0x19020c1a40x190209404 0x1902782e8 0x100a77a24 0x1902742c4 0x190465bc40x19046aa14 0x1907062a8 0x1909de100 0x190705f0c 0x19070676c0x190e8b7c0 0x190e8b664 0x190bf92cc 0x190d923cc 0x190bf917c0x1909dd760 0x190469158 0x19087edbc 0x18930e1f0 0x189316af80x100bb928c 0x100bc59e4 0x1893427f8 0x18934249c 0x189342a380x186bf377c 0x186bf36fc 0x186bf2f84 0x186bf0b5c 0x186b10c580x1889bcf84 0x1902695c4 0x100a51994 0x18663056c) libc++abi.dylib:以 NSException 类型的未捕获异常终止

2018-04-25 14:42:18.792216-0700 Steri-Vac GS[1090:855706] -[MasterNavigationViewController _viewControllerSubtreeDidGainViewController:]: unrecognized selector sent to instance 0x101210100 2018-04-25 14:42:18.792662-0700 Steri-Vac GS[1090:855706] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MasterNavigationViewController _viewControllerSubtreeDidGainViewController:]: unrecognized selector sent to instance 0x101210100' * First throw call stack: (0x186c4b164 0x185e94528 0x186c58628 0x1905c6188 0x186c50b10 0x186b35ccc 0x19029a964 0x19029d2c0 0x100a4941c 0x100a48bec 0x190205a00 0x1902055d8 0x19020c1a4 0x190209404 0x1902782e8 0x100a77a24 0x1902742c4 0x190465bc4 0x19046aa14 0x1907062a8 0x1909de100 0x190705f0c 0x19070676c 0x190e8b7c0 0x190e8b664 0x190bf92cc 0x190d923cc 0x190bf917c 0x1909dd760 0x190469158 0x19087edbc 0x18930e1f0 0x189316af8 0x100bb928c 0x100bc59e4 0x1893427f8 0x18934249c 0x189342a38 0x186bf377c 0x186bf36fc 0x186bf2f84 0x186bf0b5c 0x186b10c58 0x1889bcf84 0x1902695c4 0x100a51994 0x18663056c) libc++abi.dylib: terminating with uncaught exception of type NSException

我已经向 Apple 提交了一个错误并提交了支持它的代码,但我想我会在这里咨询智囊团,看看是否有人在此期间有任何我可以调查的内容.目前我们的应用程序没有用,我的 40% 的现场服务技术人员已经更新到 11.3,所以这对我们来说是一个关键问题.

I've filed a bug with Apple and submitted code to support it, but I thought I'd check with the brain trust here to see if anyone had anything I could look into in the mean time. For now our app is useless and 40% of my field service techs have already updated to 11.3, so it's getting to be a critical issue for us.

提前致谢,伙计们!

推荐答案

Apple 回应了我的错误!

Apple responded to my bug!

事实证明,我们的类扩展了 UIViewController 并实现了一个名为 navigationController 的属性,它是 UIViewController 的另一个实例,同时 UIViewController 有一个名为 navigationController... 的属性是 UINavigationController 的一个实例.诀窍是简单地将我们的 navigationController 重命名为 navController.冲突已解决.

It turns out that our class was extending the UIViewController and implementing a property called navigationController which was another instance of UIViewController, while at the same time UIViewController HAS a property called navigationController... is an instance of UINavigationController. The trick was to simply rename our navigationController to navController. Conflict resolved.

真正的问题是为什么这只是在更新到 Xcode 9.3 后才停止工作,并且在我们的用户更新到 iOS 11.3 之前并没有真正破坏应用程序.在 11.2 下,原始应用程序运行良好.更新到 Xcode 9.3 后,编译应用程序将无法在任何版本的 iOS 上运行.

The real question is why this only stopped working after updating to Xcode 9.3 and didn’t actually break the app till our users updated to iOS 11.3. Under 11.2 the original app ran fine. And after updating to Xcode 9.3 the compiles app wouldn’t run on any version of iOS.

很奇怪!

这篇关于iOS 11.3 和 Xcode 9.3 导致 Obj-C 应用程序启动失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆