gpt4 book ai didi

ios - 崩溃 NSProxy doesNotRecognizeSelector :

转载 作者:行者123 更新时间:2023-11-28 08:20:30 25 4
gpt4 key购买 nike

Fabric 告诉我很多用户在我的应用程序中遇到以下崩溃

crash

如果展开,我会看到以下堆栈

 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。在我的应用程序中,有一个类已准备好将数据传输到 watch 套件应用程序,但此时在构建阶段没有提及 watch 应用程序和 watch 套件扩展。

我类的代码是

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)
{ }
}

有什么建议吗?

最佳答案

看起来您的应用正在使用 NSProxy 子类作为 WCSession 的委托(delegate)。是这样吗?如果是这样,请尝试将其更改为 NSObject 子类。

关于ios - 崩溃 NSProxy doesNotRecognizeSelector :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41440768/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com