我的应用程序在物理设备上的登录页面后崩溃,但在 xCode 模拟器上没有问题。我已经根据网上看到的建议尝试调试了几个小时,但没有任何效果。
**Crash logs:**
Incident Identifier: 89F8B664-0E56-458F-9DBC-4680F6BAD3AC
CrashReporter Key: 216037edb6b5b01363303754d6b506f699263e00
Hardware Model: iPhone14,5
Process: Moonlight [26102]
Path: /private/var/containers/Bundle/Application/F26FF432-36B2-4302-B0A9-95F7B6DEEF0D/Moonlight.app/Moonlight
Identifier: com.danya.swift.Moonlight
Version: 1.0 (1)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.danya.swift.Moonlight [1879]
Date/Time: 2023-02-22 02:27:54.6242 +0300
Launch Time: 2023-02-22 02:27:38.7167 +0300
OS Version: iPhone OS 16.3 (20D47)
Release Type: User
Baseband Version: 2.40.01
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000104355224
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [26102]
Triggered by Thread: 0
Kernel Triage:
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 Moonlight 0x104355224 InstagramApi.().init() + 312
1 Moonlight 0x104355200 InstagramApi.().init() + 276
2 Moonlight 0x1043550d8 one-time initialization function for shared + 36
3 libdispatch.dylib 0x1c4ce8f88 _dispatch_client_callout + 20
4 libdispatch.dylib 0x1c4cea7d4 _dispatch_once_callout + 32
5 Moonlight 0x10438be60 ProfileTableViewController.init(coder:) + 1132
6 Moonlight 0x10438be84 @objc ProfileTableViewController.init(coder:) + 32
7 UIKitCore 0x1bfb9433c -[UIClassSwapper initWithCoder:] + 1544
8 UIFoundation 0x1c7b31390 UINibDecoderDecodeObjectForValue + 668
9 UIFoundation 0x1c7b3158c UINibDecoderDecodeObjectForValue + 1176
10 UIFoundation 0x1c7b32d00 -[UINibDecoder decodeObjectForKey:] + 316
11 UIKitCore 0x1bfb93cc4 -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsAndTrackChildViewControllerIndexWithParent:forKey:] + 188
12 UIKitCore 0x1bfb93564 -[UIViewController initWithCoder:] + 1116
13 UIKitCore 0x1bfb92cd0 -[UINavigationController initWithCoder:] + 92
14 UIKitCore 0x1bfb9433c -[UIClassSwapper initWithCoder:] + 1544
15 UIFoundation 0x1c7b31390 UINibDecoderDecodeObjectForValue + 668
16 UIFoundation 0x1c7b3158c UINibDecoderDecodeObjectForValue + 1176
17 UIFoundation 0x1c7b32d00 -[UINibDecoder decodeObjectForKey:] + 316
18 UIKitCore 0x1bfb93cc4 -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsAndTrackChildViewControllerIndexWithParent:forKey:] + 188
19 UIKitCore 0x1bfb93564 -[UIViewController initWithCoder:] + 1116
20 UIKitCore 0x1bfcb4bd8 -[UITabBarController initWithCoder:] + 80
21 UIKitCore 0x1bfb9433c -[UIClassSwapper initWithCoder:] + 1544
22 UIFoundation 0x1c7b31390 UINibDecoderDecodeObjectForValue + 668
23 UIFoundation 0x1c7b32d00 -[UINibDecoder decodeObjectForKey:] + 316
24 UIKitCore 0x1bfc56218 -[UIRuntimeConnection initWithCoder:] + 92
25 UIFoundation 0x1c7b31390 UINibDecoderDecodeObjectForValue + 668
26 UIFoundation 0x1c7b3158c UINibDecoderDecodeObjectForValue + 1176
27 UIFoundation 0x1c7b32d00 -[UINibDecoder decodeObjectForKey:] + 316
28 UIKitCore 0x1bfb944d0 -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 292
29 UIKitCore 0x1bfb33724 -[UINib instantiateWithOwner:options:] + 760
30 UIKitCore 0x1bfb32140 -[UIStoryboard __reallyInstantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 236
31 UIKitCore 0x1bfb31f7c -[UIStoryboard _instantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 80
32 libswiftUIKit.dylib 0x1c626a5d0 UIStoryboard.instantiateViewController<A>(identifier:creator:) + 248
33 Moonlight 0x10437cc64 closure #1 in WelcomeViewController.loginButtonPressed(_:) + 360
34 Moonlight 0x104369f9c closure #1 in static FUser.loginUserWith(email:password:completion:) + 336
35 Moonlight 0x10436a018 thunk for @escaping @callee_guaranteed (@guaranteed FIRAuthDataResult?, @guaranteed Error?) -> () + 76
36 libdispatch.dylib 0x1c4ce7460 _dispatch_call_block_and_release + 32
37 libdispatch.dylib 0x1c4ce8f88 _dispatch_client_callout + 20
38 libdispatch.dylib 0x1c4cf77f4 _dispatch_main_queue_drain + 928
39 libdispatch.dylib 0x1c4cf7444 _dispatch_main_queue_callback_4CF + 44
40 CoreFoundation 0x1bd7616c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
41 CoreFoundation 0x1bd74302c __CFRunLoopRun + 2036
42 CoreFoundation 0x1bd747eb0 CFRunLoopRunSpecific + 612
43 GraphicsServices 0x1f793d368 GSEventRunModal + 164
44 UIKitCore 0x1bfc3d668 -[UIApplication _run] + 888
45 UIKitCore 0x1bfc3d2cc UIApplicationMain + 340
46 libswiftUIKit.dylib 0x1c626a308 UIApplicationMain(_:_:_:_:) + 104
47 Moonlight 0x10434b344 main + 108
48 dyld 0x1dc040960 start + 2528
Thread 1:
0 libsystem_pthread.dylib 0x20b948b90 start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x20b948b90 start_wqthread + 0
Thread 3 name: com.apple.uikit.eventfetch-thread
Thread 3:
0 libsystem_kernel.dylib 0x1fb1e4da8 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x1fb1f7a1c mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x1fb1f7c5c mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x1fb1e52ec mach_msg + 24
4 CoreFoundation 0x1bd741ac4 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x1bd742d08 __CFRunLoopRun + 1232
6 CoreFoundation 0x1bd747eb0 CFRunLoopRunSpecific + 612
7 Foundation 0x1b7a7c054 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8 Foundation 0x1b7a7bf3c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9 UIKitCore 0x1bfd726a4 -[UIEventFetcher threadMain] + 436
10 Foundation 0x1b7a95518 __NSThread__start__ + 716
11 libsystem_pthread.dylib 0x20b9496cc _pthread_start + 148
12 libsystem_pthread.dylib 0x20b948ba4 thread_start + 8
Thread 4 name: com.apple.NSURLConnectionLoader
Thread 4:
0 libsystem_kernel.dylib 0x1fb1e4da8 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x1fb1f7a1c mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x1fb1f7c5c mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x1fb1e52ec mach_msg + 24
4 CoreFoundation 0x1bd741ac4 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x1bd742d08 __CFRunLoopRun + 1232
6 CoreFoundation 0x1bd747eb0 CFRunLoopRunSpecific + 612
7 CFNetwork 0x1beab2ff0 0x1be85b000 + 2457584
8 Foundation 0x1b7a95518 __NSThread__start__ + 716
9 libsystem_pthread.dylib 0x20b9496cc _pthread_start + 148
10 libsystem_pthread.dylib 0x20b948ba4 thread_start + 8
Thread 5 name: Dispatch queue: com.google.firebase.firestore.rpc
Thread 5:
0 libsystem_kernel.dylib 0x1fb1e8494 poll + 8
1 grpc 0x106801d24 pollset_work(grpc_pollset*, grpc_pollset_worker**, long long) + 1276
2 grpc 0x106803ba0 pollset_work(grpc_pollset*, grpc_pollset_worker**, long long) + 72
3 grpc 0x1067e701c cq_next(grpc_completion_queue*, gpr_timespec, void*) + 320
4 grpcpp 0x106183fbc grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) + 60
5 FirebaseFirestore 0x105655b68 firebase::firestore::remote::Datastore::PollGrpcQueue() + 104
6 FirebaseFirestore 0x1057759f0 firebase::firestore::util::Task::ExecuteAndRelease() + 184
7 libdispatch.dylib 0x1c4ce8f88 _dispatch_client_callout + 20
8 libdispatch.dylib 0x1c4cf0640 _dispatch_lane_serial_drain + 672
9 libdispatch.dylib 0x1c4cf118c _dispatch_lane_invoke + 384
10 libdispatch.dylib 0x1c4cfbe10 _dispatch_workloop_worker_thread + 652
11 libsystem_pthread.dylib 0x20b948df8 _pthread_wqthread + 288
12 libsystem_pthread.dylib 0x20b948b98 start_wqthread + 8
Thread 6:
0 libsystem_pthread.dylib 0x20b948b90 start_wqthread + 0
Thread 7:
0 libsystem_pthread.dylib 0x20b948b90 start_wqthread + 0
Thread 8:
0 libsystem_pthread.dylib 0x20b948b90 start_wqthread + 0
Thread 9:
0 libsystem_pthread.dylib 0x20b948b90 start_wqthread + 0
Thread 10:
0 libsystem_kernel.dylib 0x1fb1e567c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x20b95006c _pthread_cond_wait + 1232
2 grpc 0x1068ed3f4 gpr_cv_wait + 124
3 grpc 0x106805ef0 grpc_core::Executor::ThreadMain(void*) + 180
4 grpc 0x1068f8328 grpc_core::(anonymous namespace)::ThreadInternalsPosix::ThreadInternalsPosix(char const*, void (*)(void*), void*, bool*, grpc_core::Thread::Options const&)::'lambda'(void*)::__invoke(void*) + 140
5 libsystem_pthread.dylib 0x20b9496cc _pthread_start + 148
6 libsystem_pthread.dylib 0x20b948ba4 thread_start + 8
Thread 11:
0 libsystem_kernel.dylib 0x1fb1e567c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x20b95006c _pthread_cond_wait + 1232
2 grpc 0x1068ed3f4 gpr_cv_wait + 124
3 grpc 0x106805ef0 grpc_core::Executor::ThreadMain(void*) + 180
4 grpc 0x1068f8328 grpc_core::(anonymous namespace)::ThreadInternalsPosix::ThreadInternalsPosix(char const*, void (*)(void*), void*, bool*, grpc_core::Thread::Options const&)::'lambda'(void*)::__invoke(void*) + 140
5 libsystem_pthread.dylib 0x20b9496cc _pthread_start + 148
6 libsystem_pthread.dylib 0x20b948ba4 thread_start + 8
Thread 12:
0 libsystem_kernel.dylib 0x1fb1e567c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x20b95006c _pthread_cond_wait + 1232
2 grpc 0x1068ed3e4 gpr_cv_wait + 108
3 grpc 0x1068fc24c timer_thread(void*) + 552
4 grpc 0x1068f8328 grpc_core::(anonymous namespace)::ThreadInternalsPosix::ThreadInternalsPosix(char const*, void (*)(void*), void*, bool*, grpc_core::Thread::Options const&)::'lambda'(void*)::__invoke(void*) + 140
5 libsystem_pthread.dylib 0x20b9496cc _pthread_start + 148
6 libsystem_pthread.dylib 0x20b948ba4 thread_start + 8
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000001 x2: 0x0000000214e1bf78 x3: 0x0000000280e68e00
x4: 0x0000000000000063 x5: 0x0000000000000041 x6: 0x0000000000000072 x7: 0x0000000000000000
x8: 0x0000000000000000 x9: 0x0000000000000000 x10: 0x0000000000000dc0 x11: 0x00000000000007fb
x12: 0x00000000a3603893 x13: 0x00000000000007fd x14: 0x00000000a3804038 x15: 0x00000000a3603893
x16: 0x0000000214e1bf48 x17: 0x60f0000214e1bf48 x18: 0x0000000000000000 x19: 0x0000000283015d50
x20: 0x000000016bab83e0 x21: 0x0000000280e69bc0 x22: 0xc000000000000024 x23: 0x4000000280e69bc0
x24: 0x00000001b9303e19 x25: 0x0000000000000002 x26: 0x00000001045d2000 x27: 0x0000000000000468
x28: 0x00000001045d7000 fp: 0x000000016bab8420 lr: 0x0000000104355200
sp: 0x000000016bab83e0 pc: 0x0000000104355224 cpsr: 0x60001000
far: 0x00000001043550b4 esr: 0xf2000001 (Breakpoint) brk 1
Binary Images:
0x104344000 - 0x104583fff Moonlight arm64 <6dafd094a824333fb825b7dcedfc5dc3> /private/var/containers/Bundle/Application/F26FF432-36B2-4302-B0A9-95F7B6DEEF0D/Moonlight.app/Moonlight
0x1c4ce5000 - 0x1c4d2bfff libdispatch.dylib arm64e <ded4d0a5142032ae83a6c31d938a1c9a> /usr/lib/system/libdispatch.dylib
0x1bf89c000 - 0x1c108ffff UIKitCore arm64e <cf21ad9cefbf3961a7c054bd30cefea9> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x1c7b23000 - 0x1c7c5afff UIFoundation arm64e <22746b0a15463d81ae08ee0f17206e53> /System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation
0x1c6235000 - 0x1c62a9fff libswiftUIKit.dylib arm64e <ed49edbf22363545afc1e4cf7a29aff2> /usr/lib/swift/libswiftUIKit.dylib
0x1bd6c7000 - 0x1bdaacfff CoreFoundation arm64e <42ccfc7bff323d258f01ccb2ad843a8b> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x1f793c000 - 0x1f7944fff GraphicsServices arm64e <85419099269b336d86b40d52d0ff6923> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1dc02b000 - 0x1dc0ae093 dyld arm64e <4b042f280d1430eca1de3dbb10866ad7> /usr/lib/dyld
0x20b948000 - 0x20b953fff libsystem_pthread.dylib arm64e <45ac734e66493ee2a0963fd66441ab78> /usr/lib/system/libsystem_pthread.dylib
0x1fb1e4000 - 0x1fb21bfeb libsystem_kernel.dylib arm64e <c76e6bed463530c68f19fb829bbe1ae1> /usr/lib/system/libsystem_kernel.dylib
0x1b7a3a000 - 0x1b8383fff Foundation arm64e <e5f615c7cc5e3656860041c767812a35> /System/Library/Frameworks/Foundation.framework/Foundation
0x1be85b000 - 0x1bec24fff CFNetwork arm64e <7f3313c9143533338c82dc961429d0b3> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x10677c000 - 0x106a33fff grpc arm64 <57469164f14331889e44974a12e36384> /private/var/containers/Bundle/Application/F26FF432-36B2-4302-B0A9-95F7B6DEEF0D/Moonlight.app/Frameworks/grpc.framework/grpc
0x10616c000 - 0x1061c7fff grpcpp arm64 <12eec987bb2939488c9f33900bd54816> /private/var/containers/Bundle/Application/F26FF432-36B2-4302-B0A9-95F7B6DEEF0D/Moonlight.app/Frameworks/grpcpp.framework/grpcpp
0x105628000 - 0x105847fff FirebaseFirestore arm64 <e766689ebf0936a0aea7116cdb5e6cb2> /private/var/containers/Bundle/Application/F26FF432-36B2-4302-B0A9-95F7B6DEEF0D/Moonlight.app/Frameworks/FirebaseFirestore.framework/FirebaseFirestore
EOF
我已经查看了有关其他堆栈问题的所有建议,但没有任何效果。请帮忙。
我也遇到过同样的事故。分享以防有帮助。就我而言,崩溃是在我创建第二个方案和项目的相应目标后开始发生的。我已经开始使用环境变量来指定我的生产与开发应用程序。
例如我添加:
Edit Scheme -> Run -> Arguments -> Environment Variables: [Name: environment, Value: dev]
然后在 AppDelegate 中引用它们:
ProcessInfo.processInfo.environment["environment"] == “dev”
告诉应用程序使用哪个配置文件。
这在直接从 Xcode 构建时有效,但在设备上构建时失败,因为当用户在设备上启动应用程序时这些环境变量不可用。因为这些在这种情况下不起作用,所以我的构建路径为空,并且在应用程序启动之前崩溃了。它将显示启动屏幕,然后弹出。
因此,我想如果您为此目的在方案中设置了环境变量,并考虑在每个目标的构建设置中将其替换为“Swift Compiler - Custom Flags”(类似于 Daniel 的答案here。
),那么我想值得一看。