identifierForVendor崩溃为EXC_BAD_ACCESS

时间:2018-04-25 09:56:12

标签: objective-c iphone crash exc-bad-access uidevice

我不是经常遇到这个问题,并且所有版本的热门问题都超过了IOS 11。

这是崩溃日志之一:

  

操作系统版本:iPhone OS 11.1.2(15B202)

     

基带版本:不适用

     

报告版本:104

     

异常类型:EXC_BAD_ACCESS(SIGSEGV)

     

异常子类型:KERN_INVALID_ADDRESS位于0x00000101831801e0

     

VM区域信息:0x101831801e0不在任何区域。之前区域之后的字节:1097952920033

 REGION TYPE                      START - END             [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL

 MALLOC_NANO (reserved) 00000001d8000000-00000001e0000000 [128.0M] rw-/rwx SM=NUL  ...(unallocated)
     

--->
        未使用的空间

     

终止信号:分段故障:11

     

终止原因:命名空间SIGNAL,代码0xb

     

终止进程:exc handler [0]

     

由线程触发:0

     

过滤后的系统日志:

     

没有找到

     

线程0名称:Dispatch queue:com.apple.main-thread

     

线程0崩溃:

     

0 ??? 0x00000101831801e0 0 + 1106005983712

     

1 MobileCoreServices 0x0000000183188af0 - [LSApplicationWorkspace deviceIdentifierForVendor] + 192

     

2 UIKit 0x000000018ad5cd48 - [UIDevice identifierForVendor] + 56

     

3 Test-Demo-iOS 0x000000010073cc4c __35 + [getInstance_:vendorKey:] _ block_invoke + 160

     

4 libdispatch.dylib 0x0000000180d75048 _dispatch_client_callout + 16

     

5 libdispatch.dylib 0x0000000180d78710 dispatch_once_f $ VARIANT $ mp + 60

     

...

此代码出现在viewDidLoad的开头。在getInstance_中,我的原始代码是:

    c_inst->dbg("_device_id", [[[[UIDevice currentDevice] identifierForVendor] UUIDString]UTF8String]);

此代码可以解决此问题。我做了一些改变,但仍未能避免这次崩溃:

    UIDevice *device = [UIDevice currentDevice];
    if (device){
        NSUUID *idfv = [device identifierForVendor];
        if (idfv){
             c_inst->dbg("_device_id", [[idfv UUIDString] UTF8String]);
        }
    }

是否有人遇到此问题并知道崩溃的根本原因? 我还需要有人帮忙给我一些解决这个问题的建议。

由于

0 个答案:

没有答案