今天扩展在iOS 8.1.2上启动之前崩溃

前端之家收集整理的这篇文章主要介绍了今天扩展在iOS 8.1.2上启动之前崩溃前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我一直在制作一个今天的扩展程序,从源文件中下载文章显示最新的扩展名.
整个事情在iOS 8上运行正常,仍然在iOS 8.1上工作,然后来到iOS 8.1.2,我们开始抱怨现在的扩展不再工作了.
我尝试在iOS 8.1.2设备上调试,在扩展甚至启动之前,它会崩溃,出现以下错误
Terminating app due to uncaught exception 'NSInvalidArgumentException',reason: '*** setObjectForKey: object cannot be nil (key: <__NSConcreteUUID 0x174027280> 5AFB07AB-5DCD-46FE-8D07-44DE0F3789F2)'

我已经阅读了关于在开发今天的扩展时发生的常见错误的这篇文章http://www.atomicbird.com/blog/ios-app-extension-tip

汤姆·哈灵顿在他的帖子中说:

In iOS 8 (and other recent versions),enabling modules in Xcode’s build settings means you don’t need to explicitly list all the frameworks you want to use. They’ll be found automatically.

But this isn’t the case with NotificationCenter.framework,which Today extensions use. If you remove that from the build settings,you won’t get any build warnings or errors. But when you try to load the extension,you’ll get an exception from libextension.dylib and your extension won’t load. The exception message is not enlightening:

2014-08-16 12:06:53.793 TodayTestExtension[41313:6111763] * Terminating
app due to uncaught exception ‘NSInvalidArgumentException’,reason: ‘*

setObjectForKey: object cannot be nil (key: <__NSConcreteUUID
0x7fd729422390> ED3B42F8-66CD-4CB0-BCD5-F3DBA6F34DB5)’
If you’re doing a today extension,just leave that framework in the build settings. It shouldn’t need to be there,but it does.

我的扩展程序在其构建设置中包含NotificationCenter.framework,但我怀疑我的问题可能在某些方面类似.

任何人面临类似的问题?任何想法如何解决

解决方法

如果在“Info.plist”中使用NSExtensionPrincipalClass为了定义一个不存在的ViewController的名称来定义一个基类(而不是使用一个故事板),也会发生此错误.

当使用Swift时,请确保使用模块名称(通常是目标的名称)像“Module.MyViewController”一样在该类前面.

原文链接:https://www.f2er.com/iOS/334995.html

猜你在找的iOS相关文章