今天扩展在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”一样在该类前面.

以上是来客网为你收集整理的今天扩展在iOS 8.1.2上启动之前崩溃全部内容,希望文章能够帮你解决今天扩展在iOS 8.1.2上启动之前崩溃所遇到的程序开发问题。

如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。