Fabric告诉我很多用户在我的应用程序中发生了以下崩溃
crash http://i65.tinypic.com/30uqnvn.png
如果我展开,我会看到以下堆栈
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x18ef201c0 __exceptionPreprocess
1 libobjc.A.dylib 0x18d95855c objc_exception_throw
2 CoreFoundation 0x18ef20108 -[NSException initWithCoder:]
3 Foundation 0x18f9eb714 -[NSProxy doesNotRecognizeSelector:]
4 CoreFoundation 0x18ef24278 ___forwarding___
5 CoreFoundation 0x18ee1e59c _CF_forwarding_prep_0
6 WatchConnectivity 0x1a39caff0 __57-[WCSession onqueue_completeSwitchTask:withSessionState:]_block_invoke
7 Foundation 0x18f9e17e4 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
8 Foundation 0x18f926358 -[NSBlockOperation main]
9 Foundation 0x18f916954 -[__NSOperationInternal _start:]
10 Foundation 0x18f9e3b90 __NSOQSchedule_f
11 libdispatch.dylib 0x18dda91c0 _dispatch_client_callout
12 libdispatch.dylib 0x18ddb7444 _dispatch_queue_serial_drain
13 libdispatch.dylib 0x18ddac9a8 _dispatch_queue_invoke
14 libdispatch.dylib 0x18ddb938c _dispatch_root_queue_drain
15 libdispatch.dylib 0x18ddb90ec _dispatch_worker_thread3
16 libsystem_pthread.dylib 0x18dfb12c8 _pthread_wqthread
17 libsystem_pthread.dylib 0x18dfb0db4 start_wqthread
我的假设是有一些东西不能与WatchKit一起使用。在我的应用程序中,有一个类已准备好将数据传输到监视工具包应用程序,但在构建阶段的这个时刻,没有参考监视应用程序和监视工具包扩展。
我班上的代码是
import Foundation
import WatchConnectivity
class WatchManager: NSObject
{
func setLanguage(localization: String)
{
if #available(iOS 9.0, *) {
if WCSession.isSupported() {
let watchSession = WCSession.defaultSession()
watchSession.delegate = self
watchSession.activateSession()
if watchSession.paired && watchSession.watchAppInstalled {
watchSession.transferUserInfo(["localization": localization])
}
}
}
}
}
extension WatchManager: WCSessionDelegate
{
@available(iOS 9.3, *)
func session(session: WCSession, activationDidCompleteWithState activationState: WCSessionActivationState, error: NSError?)
{ }
@available(iOS 9.0, *)
func sessionDidBecomeInactive(session: WCSession)
{ }
@available(iOS 9.0, *)
func sessionDidDeactivate(session: WCSession)
{ }
}
有什么建议吗?
答案 0 :(得分:0)
您的应用看起来正在使用NSProxy
子类作为WCSession
的委托。是这样的吗?如果是这样,请尝试将其更改为NSObject
子类。