-[meetingbot4ios.AppDelegate window]: unrecognized selector sent to instance

这个错误的困扰了我半天,具体错误如下:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-meetingbot4ios.AppDelegate window: unrecognized selector sent to instance 0x60000370c0c0'

*** First throw call stack:

(

0 CoreFoundation 0x00000001804ae0f8 __exceptionPreprocess + 172

1 libobjc.A.dylib 0x0000000180087db4 objc_exception_throw + 56

2 CoreFoundation 0x00000001804c2f48 +NSObject(NSObject) instanceMethodSignatureForSelector: + 0

3 CoreFoundation 0x00000001804b2024 forwarding + 732

4 CoreFoundation 0x00000001804b456c _CF_forwarding_prep_0 + 92

5 MobileRTC 0x00000001125bed2c MobileRTC + 16624940

6 CoreFoundation 0x00000001803de7a8 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 140

7 CoreFoundation 0x00000001803de6cc ___CFXRegistrationPost_block_invoke + 84

8 CoreFoundation 0x00000001803ddbbc _CFXRegistrationPost + 404

9 CoreFoundation 0x00000001803dd598 _CFXNotificationPost + 688

10 MobileRTC 0x0000000112792840 MobileRTC + 18540608

11 MobileRTC 0x0000000113b82624 MobileRTC + 39446052

12 MobileRTC 0x0000000113b7f7a8 MobileRTC + 39434152

13 MobileRTC 0x0000000113d0f0b0 MobileRTC + 41070768

14 MobileRTC 0x0000000113cfc4b0 MobileRTC + 40993968

15 MobileRTC 0x0000000113cfe520 MobileRTC + 41002272

16 MobileRTC 0x0000000111675520 MobileRTC + 595232

17 MobileRTC 0x0000000113cfde1c MobileRTC + 41000476

18 MobileRTC 0x0000000113b83188 MobileRTC + 39448968

19 MobileRTC 0x0000000113516a04 MobileRTC + 32713220

20 MobileRTC 0x00000001116540bc MobileRTC + 458940

21 meetingbot4ios 0x0000000102d00fe8 $s14meetingbot4ios11AppDelegateC11joinMeeting33_AF24E5846D9D1EA8BDA822FD40DAC3E8LLyyF + 700

22 meetingbot4ios 0x0000000102d00858 $s14meetingbot4ios11AppDelegateC21onMobileRTCAuthReturnyySo0eF5ErrorVF + 308

23 meetingbot4ios 0x0000000102d00b28 $s14meetingbot4ios11AppDelegateC21onMobileRTCAuthReturnyySo0eF5ErrorVFTo + 44

24 libdispatch.dylib 0x00000001030a7ec4 _dispatch_call_block_and_release + 24

25 libdispatch.dylib 0x00000001030a973c _dispatch_client_callout + 16

26 libdispatch.dylib 0x00000001030b93f8 _dispatch_main_queue_drain + 1228

27 libdispatch.dylib 0x00000001030b8f1c _dispatch_main_queue_callback_4CF + 40

28 CoreFoundation 0x000000018040e960 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12

29 CoreFoundation 0x0000000180409078 __CFRunLoopRun + 1936

30 CoreFoundation 0x00000001804084d4 CFRunLoopRunSpecific + 572

31 GraphicsServices 0x000000018ef2aae4 GSEventRunModal + 160

32 UIKitCore 0x00000001853d0a28 -UIApplication _run + 868

33 UIKitCore 0x00000001853d46b0 UIApplicationMain + 124

34 SwiftUI 0x00000001ccf100e4 OUTLINED_FUNCTION_65 + 492

35 SwiftUI 0x00000001ccf0ff8c OUTLINED_FUNCTION_65 + 148

36 SwiftUI 0x00000001ccbcd6d8 OUTLINED_FUNCTION_0 + 92

37 meetingbot4ios 0x0000000102cf7618 s14meetingbot4ios10MeetingBotV5mainyyFZ + 40

38 meetingbot4ios 0x0000000102d07e10 main + 12

39 dyld 0x0000000103635544 start_sim + 20

40 ??? 0x000000010314a154 0x0 + 4346650964

41 ??? 0x8e7d000000000000 0x0 + 10267362725474598912

)

libc++abi: terminating due to uncaught exception of type NSException

下面是我的解决办法。

class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

// 其他代码...

}

只需要在其中增加var window: UIWindow?这行代码就可以了。

相关推荐
VicLi1 天前
把常用 iOS 调试操作放进一个 macOS 控制台: iCATBox
ios
茶底世界之下1 天前
雾景需要更强反差吗?用 Awaking 检查树影与雾气的平衡
ios
终端安全笔记1 天前
下一个大版本要动的三处:更新指令、传输要求、策略写法
网络安全·ios·1024程序员节·移动设备管理
法的空间1 天前
AI 编程时代,为什么 Dart 分析会拖慢大型项目的开发
android·flutter·ios
season_zhu1 天前
Skills For Real Engineers 系列之二:grill,把需求想清楚,也别把自己问进死胡同
ios·ai编程
美狐美颜SDK开放平台2 天前
准备开发直播APP?视频美颜SDK接入前的十项检查清单
android·ios·音视频·直播美颜sdk·视频美颜sdk
承渊政道2 天前
iOS远程控制电脑用什么好?iPhoneiPad远程控制Windows电脑最佳方案2026横评
windows·ios·远程控制·1024程序员节·iphone ipad
茶底世界之下2 天前
彩色建筑适合转黑白吗?用 Awaking 检查颜色消失后的层次
ios
黑科技iOS上架3 天前
App Store 26年10月新应用审核放缓大量应用不进审
ios·审核
OxYGC3 天前
手机为什么能“自动跳过“开屏广告?李跳跳、GKD 与 iOS 代理软件原理盘点
android·ios·开屏广告·广告屏蔽