奇怪的 iOS 应用程序在模拟器上崩溃

Strange iOS app crashes on simulator

我有一个奇怪的崩溃。

Process:               MyApp [91555]
Path:                  /Users/USER/Library/Developer/CoreSimulator/Devices/3EDD7C49-65E2-4046-8BEE-0AC829A2A276/data/Containers/Bundle/Application/7667EA2E-A89B-44E8-8C14-828700B482E1/MyApp.app/MyApp
Identifier:            MyApp
Version:               6.7 (6.7.0.3709)
Code Type:             X86-64 (Native)
Parent Process:        launchd_sim [11615]
Responsible:           MyApp [91555]
User ID:               501

Date/Time:             2017-03-04 18:29:43.848 +0800
OS Version:            Mac OS X 10.12.3 (16D32)
Report Version:        12
Anonymous UUID:        74452B06-5487-4AB3-CA87-6DE166EFD550

Time Awake Since Boot: 790000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (Code Signature Invalid)
Exception Codes:       0x0000000000000032, 0x00000001013a9018
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 0x2

kernel messages:

VM Regions Near 0x1013a9018:
--> __TEXT                 00000001013a9000-0000000113ce1000 [297.2M] r-x/rwx SM=COW  /Users/USER/Library/Developer/CoreSimulator/Devices/3EDD7C49-65E2-4046-8BEE-0AC829A2A276/data/Containers/Bundle/Application/7667EA2E-A89B-44E8-8C14-828700B482E1/MyApp.app/MyApp
    __DATA                 0000000113ce1000-0000000115cef000 [ 32.1M] rw-/rwx SM=COW  /Users/USER/Library/Developer/CoreSimulator/Devices/3EDD7C49-65E2-4046-8BEE-0AC829A2A276/data/Containers/Bundle/Application/7667EA2E-A89B-44E8-8C14-828700B482E1/MyApp.app/MyApp

Application Specific Information:
CoreSimulator 338.16 - Device: iPhone 7 - Runtime: iOS 10.2 (14C89) - DeviceType: iPhone 7

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   dyld_sim                        0x000000011cea69dc ImageLoaderMachO::usesTwoLevelNameSpace() const + 8
1   dyld_sim                        0x000000011ceac85b ImageLoaderMachOCompressed::doBindFastLazySymbol(unsigned int, ImageLoader::LinkContext const&, void (*)(), void (*)()) + 43
2   dyld_sim                        0x000000011ce9abb9 dyld::fastBindLazySymbol(ImageLoader**, unsigned long) + 90
3   libdyld.dylib                   0x000000012b2b7516 dyld_stub_binder + 282
4   ???                             0x0000000113ce1008 0 + 4627238920
5   MyApp                           0x000000010ecca652 __54-[SpriteDataManager loadAnimFrames:savePath:callback:]_block_invoke_2 + 210
6   libclang_rt.asan_iossim_dynamic.dylib   0x000000012827b334 __wrap_dispatch_async_block_invoke + 260
7   libdispatch.dylib               0x000000012b24f808 _dispatch_call_block_and_release + 12
8   libdispatch.dylib               0x000000012b27112e _dispatch_client_callout + 8
9   libdispatch.dylib               0x000000012b2584fb _dispatch_main_queue_callback_4CF + 1054
10  com.apple.CoreFoundation        0x0000000121e88e49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
11  com.apple.CoreFoundation        0x0000000121e4e37d __CFRunLoopRun + 2205
12  com.apple.CoreFoundation        0x0000000121e4d884 CFRunLoopRunSpecific + 420
13  com.apple.GraphicsServices      0x000000012a484a6f GSEventRunModal + 161
14  com.apple.UIKit                 0x000000012408ec68 UIApplicationMain + 159
15  MyApp                           0x0000000104c4f326 main + 1238
16  libdyld.dylib                   0x000000012b2ba68d start + 1

由于模拟器上的应用程序根本不需要代码签名,为什么异常类型显示 EXC_BAD_ACCESS(代码签名无效)?谁能解释一下这种崩溃是什么以及它是如何发生的。

  1. 尝试进入 "Edit Scheme" 并取消选中 "Build" 中的所有测试清理您的应用并再次 运行 它。
  2. 转到 TARGETS> Tests 确保您已登录,或者如果其 ad hoc 已在测试目标中签名,则为测试目标设置配置文件或单击 Automatically Signing