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

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...