iOS 统一存储模块与百度地图冲突引起崩溃

问题描述

在引入统一存储和特定版本的百度地图 SDK 后,APP 在启动阶段产生崩溃。崩溃调用栈如下:

Thread 12 name:  Dispatch queue: NSOperationQueue 0x1040a1ed0 (QOS: UNSPECIFIED)
Thread 12 Crashed:
0   libsystem_kernel.dylib            0x00000001826f92e0 __pthread_kill + 8
1   libsystem_pthread.dylib           0x000000018289a288 pthread_kill$VARIANT$mp + 376
2   libsystem_c.dylib                 0x0000000182667d0c abort + 140
3   libsystem_malloc.dylib            0x0000000182731838 szone_size + 0
4   **************                  0x0000000101604a30 _baidu_vi::CVString::Empty+ 9390640 () + 32
5   **************                  0x00000001016013b4 xmlFreeDoc + 48
6   **************                  0x00000001016013a0 xmlFreeDoc + 28
7   **************                  0x00000001016013a0 xmlFreeDoc + 28
8   **************                  0x00000001016013a0 xmlFreeDoc + 28
9   **************                  0x0000000101d7cb78 -[RVDDXMLNode dealloc] + 17222520 (RVDDXMLNode.m:282)
10  **************                  0x0000000101d916b0 -[APDAOConfig compile] + 17307312 (APDAOConfig.m:138)
11  CoreFoundation                    0x0000000182c7a580 __invoking___ + 144
12  CoreFoundation                    0x0000000182b59748 -[NSInvocation invoke] + 284
13  Foundation                        0x000000018369b308 -[NSInvocationOperation main] + 40
14  Foundation                        0x00000001835dbcac -[__NSOperationInternal _start:] + 848
15  Foundation                        0x000000018369c76c __NSOQSchedule_f + 404
16  libdispatch.dylib                 0x0000000182564a60 _dispatch_client_callout + 16
17  libdispatch.dylib                 0x000000018256ce94 _dispatch_continuation_pop$VARIANT$mp + 424
18  libdispatch.dylib                 0x000000018256b7cc _dispatch_async_redirect_invoke$VARIANT$mp + 604
19  libdispatch.dylib                 0x0000000182571cac _dispatch_root_queue_drain + 588
20  libdispatch.dylib                 0x00000001825719fc _dispatch_worker_thread3 + 120
21  libsystem_pthread.dylib           0x0000000182897fac _pthread_wqthread + 1176
22  libsystem_pthread.dylib           0x0000000182897b08 start_wqthread + 4

Thread5

解决办法

在 App 初始化阶段(可以在 main 函数中)添加如下代码:

#import <MPDataCenter/APDataCenter.h>
// App 初始化方法中设置
APDataCenter.compatibility = YES;
说明

该方法在 10.1.32 及以上基线版本有效。