我正在使用Mapbox和Parse Api支持编写一个快速的应用程序。我安装了CocoaPods的Mapbox SDK 3.0.0,并使用他们网站提供的this guide设置环境,一切正常。但是,当我使用CocoaPods通过this guide添加Parse iOS框架时,出现了问题:我的应用程序在启动开始时崩溃,错误如下所示。但奇怪的是这次崩溃只发生在我在模拟器上测试这个应用程序时,它在实际设备上运行良好且功能正常。有人可以帮我解决这个问题吗?谢谢
CoreFoundation`CFStringCompare:
0x10a2d3590 <+0>: pushq %rbp
0x10a2d3591 <+1>: movq %rsp, %rbp
0x10a2d3594 <+4>: pushq %r15
0x10a2d3596 <+6>: pushq %r14
0x10a2d3598 <+8>: pushq %r12
0x10a2d359a <+10>: pushq %rbx
0x10a2d359b <+11>: movq %rdx, %r14
0x10a2d359e <+14>: movq %rsi, %r15
0x10a2d35a1 <+17>: movq %rdi, %rbx
0x10a2d35a4 <+20>: testq %rbx, %rbx
0x10a2d35a7 <+23>: js 0x10a2d3613 ; <+131>
-> 0x10a2d35a9 <+25>: movq (%rbx), %rax
0x10a2d35ac <+28>: testq %rax, %rax
0x10a2d35af <+31>: je 0x10a2d35f1 ; <+97>
0x10a2d35b1 <+33>: leaq 0x3551b8(%rip), %rcx ; __CFConstantStringClassReferencePtr
0x10a2d35b8 <+40>: cmpq (%rcx), %rax
0x10a2d35bb <+43>: je 0x10a2d35f1 ; <+97>
0x10a2d35bd <+45>: movq 0x34e3c4(%rip), %rcx ; __kCFStringTypeID
0x10a2d35c4 <+52>: xorl %r12d, %r12d
0x10a2d35c7 <+55>: cmpq $0x3ff, %rcx
0x10a2d35ce <+62>: ja 0x10a2d35db ; <+75>
0x10a2d35d0 <+64>: leaq 0x353199(%rip), %rdx ; __CFRuntimeObjCClassTable
0x10a2d35d7 <+71>: movq (%rdx,%rcx,8), %r12
0x10a2d35db <+75>: cmpq %r12, %rax
0x10a2d35de <+78>: je 0x10a2d35f1 ; <+97>
0x10a2d35e0 <+80>: testb $0x1, %al
0x10a2d35e2 <+82>: je 0x10a2d3613 ; <+131>
0x10a2d35e4 <+84>: movq %rbx, %rdi
0x10a2d35e7 <+87>: callq 0x10a4548a8 ; symbol stub for: object_getClass
0x10a2d35ec <+92>: cmpq %r12, %rax
0x10a2d35ef <+95>: jne 0x10a2d3613 ; <+131>
0x10a2d35f1 <+97>: movb 0x8(%rbx), %cl
0x10a2d35f4 <+100>: movb %cl, %al
0x10a2d35f6 <+102>: andb $0x5, %al
0x10a2d35f8 <+104>: movzbl %al, %eax
0x10a2d35fb <+107>: andb $0x60, %cl
0x10a2d35fe <+110>: cmpl $0x4, %eax
0x10a2d3601 <+113>: jne 0x10a2d3628 ; <+152>
0x10a2d3603 <+115>: leaq 0x10(%rbx), %rax
0x10a2d3607 <+119>: testb %cl, %cl
0x10a2d3609 <+121>: je 0x10a2d360e ; <+126>
0x10a2d360b <+123>: movq (%rax), %rax
0x10a2d360e <+126>: movzbl (%rax), %ecx
0x10a2d3611 <+129>: jmp 0x10a2d3636 ; <+166>
0x10a2d3613 <+131>: movq 0x342b1e(%rip), %rsi ; "length"
0x10a2d361a <+138>: movq %rbx, %rdi
0x10a2d361d <+141>: callq *0x355bd5(%rip) ; (void *)0x000000010c3ea800: objc_msgSend
0x10a2d3623 <+147>: movq %rax, %rcx
0x10a2d3626 <+150>: jmp 0x10a2d3636 ; <+166>
0x10a2d3628 <+152>: testb %cl, %cl
0x10a2d362a <+154>: je 0x10a2d3632 ; <+162>
0x10a2d362c <+156>: movq 0x18(%rbx), %rcx
0x10a2d3630 <+160>: jmp 0x10a2d3636 ; <+166>
0x10a2d3632 <+162>: movq 0x10(%rbx), %rcx
0x10a2d3636 <+166>: xorl %edx, %edx
0x10a2d3638 <+168>: xorl %r9d, %r9d
0x10a2d363b <+171>: movq %rbx, %rdi
0x10a2d363e <+174>: movq %r15, %rsi
0x10a2d3641 <+177>: movq %r14, %r8
0x10a2d3644 <+180>: popq %rbx
0x10a2d3645 <+181>: popq %r12
0x10a2d3647 <+183>: popq %r14
0x10a2d3649 <+185>: popq %r15
0x10a2d364b <+187>: popq %rbp
0x10a2d364c <+188>: jmp 0x10a2cf310 ; CFStringCompareWithOptionsAndLocale
0x10a2d3651 <+193>: nopw %cs:(%rax,%rax)
完整堆栈跟踪如下所示:
* thread #1: tid = 0x26780, 0x00000001024555a9 CoreFoundation`CFStringCompare + 25, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x00000001024555a9 CoreFoundation`CFStringCompare + 25
frame #1: 0x000000010ddde349 CoreTelephony`sCTEventForNotificationString(__CFString const*) + 77
frame #2: 0x000000010de15a80 CoreTelephony`_CTServerConnectionRegisterForNotification + 22
frame #3: 0x000000010ddfdfab CoreTelephony`-[CTTelephonyNetworkInfo setUpServerConnection] + 215
frame #4: 0x000000010ddfe250 CoreTelephony`-[CTTelephonyNetworkInfo init] + 257
frame #5: 0x0000000102004d7c Mapbox`-[MGLMapboxEventsData init] + 588
frame #6: 0x0000000102006be0 Mapbox`-[MGLMapboxEvents resumeMetricsCollection] + 416
frame #7: 0x0000000102005aa0 Mapbox`-[MGLMapboxEvents init] + 2064
frame #8: 0x0000000102006236 Mapbox`__32+[MGLMapboxEvents sharedManager]_block_invoke_2 + 38
frame #9: 0x0000000105d8449b libdispatch.dylib`_dispatch_client_callout + 8
frame #10: 0x0000000105d6fe28 libdispatch.dylib`dispatch_once_f + 543
frame #11: 0x00000001020061ff Mapbox`__32+[MGLMapboxEvents sharedManager]_block_invoke + 95
frame #12: 0x000000010200611d Mapbox`+[MGLMapboxEvents sharedManager] + 221
frame #13: 0x0000000102022a7c Mapbox`+[MGLAccountManager setAccessToken:] + 204
frame #14: 0x000000010202267e Mapbox`+[MGLAccountManager load] + 222
frame #15: 0x0000000104558dff libobjc.A.dylib`call_load_methods + 731
frame #16: 0x0000000104559892 libobjc.A.dylib`load_images + 123
frame #17: 0x0000000101e42a75
frame #18: 0x0000000101e4d796
frame #19: 0x0000000101e4d73b
frame #20: 0x0000000101e4caba
frame #21: 0x0000000101e4cb4f
frame #22: 0x0000000101e42d79
frame #23: 0x0000000101e45fed
frame #24: 0x0000000101e42251
frame #25: 0x00007fff6bb86656 dyld`dyld::useSimulatorDyld(int, macho_header const*, char const*, int, char const**, char const**, char const**, unsigned long*) + 1702
frame #26: 0x00007fff6bb8505c dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 208
frame #27: 0x00007fff6bb81276 dyld`dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) + 512
frame #28: 0x00007fff6bb81036 dyld`_dyld_start + 54
答案 0 :(得分:1)
Core Telephony存在一个问题,刚刚修复并将在3.0.1中出现。在此期间,您可以避免链接Core Telephony,也可以安装预览版本,如下所示:
pod 'Mapbox-iOS-SDK', :podspec => 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native/ios-v3.0.1-pre.1/ios/Mapbox-iOS-SDK.podspec'
答案 1 :(得分:0)
我得到了它! 如果你通过CocoaPod安装了这两个api,CocoaPod会将这两个框架目标中的每一个与相应的库链接起来。 但是Mapbox-iOS-SDK还必须提供一个库:CoreTelephony。 单击 Pods 项目,然后选择目标作为Mapbox-iOS-SDK,在Build Phases选项卡中,转到Link Binary with Libraries并为Mapbox添加CoreTelephony.framework。它应该工作正常。
此外,关于Mapbox SDK 3.0.0 api设置,应该向info.plist添加总共2个键:
如果使用swift,应该创建一个桥接头作为你想要的任何名称,然后添加以下代码(你不需要在桥接头中导入Parse,因为只有Mapbox是用Objective-C编写的):
#import <Mapbox/Mapbox.h>
然后将构建设置中的 Objective - C Bridging Header 值更改为存储桥接header.h文件的路径(例如: Briding-Header.h 强>)。
注意:您需要确保将桥接头文件存储在项目根文件夹下。如果没有,您需要先指定它所在的子文件夹。
最后,不要忘记在您想要使用它的位置导入Mapbox和Parse:
import Bolts
import Parse
import Mapbox
希望这有帮助!