[NSProgress cancel] _block_invoke崩溃,也许在AFNetworking中

问题描述

我通过Firebase收到了118个崩溃报告(来自单个用户):

App\SkillUsed {#366 ▼
  #table: "skills_used"
  #primaryKey: "usage_id"
  +timestamps: false
  #fillable: array:3 [▶]
  #connection: "mysql"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:3 [▼
    "usage_id" => 85
    "sid" => 1
    "incident_id" => 55
  ]
  #original: array:3 [▼
    "usage_id" => 85
    "sid" => 1
    "incident_id" => 55
  ]
  #changes: []
  #casts: []
  #classCastCache: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: array:1 [▼
    "SkillName" => App\Skill {#381 ▼
      #table: "skills"
      #primaryKey: "did"
      +timestamps: false
      #connection: "mysql"
      #keyType: "int"
      +incrementing: true
      #with: []
      #withCount: []
      #perPage: 15
      +exists: true
      +wasRecentlyCreated: false
      #attributes: array:4 [▼
        "sid" => 1
        "gid" => 2
        "skills_name" => "Patient Assessment"
        "deleted" => 0
      ]
      #original: array:4 [▼
        "sid" => 1
        "gid" => 2
        "skills_name" => "Patient Assessment"
        "deleted" => 0
      ]
      #changes: []
      #casts: []
      #classCastCache: []
      #dates: []
      #dateFormat: null
      #appends: []
      #dispatchesEvents: []
      #observables: []
      #relations: []
      #touches: []
      #hidden: []
      #visible: []
      #fillable: []
      #guarded: array:1 [▼
        0 => "*"
      ]
    }
  ]
  #touches: []
  #hidden: []
  #visible: []
  #guarded: array:1 [▼
    0 => "*"
  ]
}

检查EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000010 Crashed: com.apple.root.background-qos 0 Foundation 0x18287a4b4 __20-[NSProgress cancel]_block_invoke_3 + 16 1 libdispatch.dylib 0x1816bea54 _dispatch_call_block_and_release + 24 2 libdispatch.dylib 0x1816bea14 _dispatch_client_callout + 16 3 libdispatch.dylib 0x1816cbea4 _dispatch_root_queue_drain + 1032 4 libdispatch.dylib 0x1816cba38 _dispatch_worker_thread3 + 120 5 libsystem_pthread.dylib 0x18196706c _pthread_wqthread + 1268 6 libsystem_pthread.dylib 0x181966b6c start_wqthread + 4 的文档,看来它将调用[NSProgress cancel]对象上的cancellationHandler块。我已经在我的项目中搜索了其中一个块,而我发现的唯一一个块是在AFNetworking(NSProgress)中。

AFURLSessionManager.m

我的猜测是__weak __typeof__(task) weakTask = task; for (NSProgress *progress in @[ _uploadProgress,_downloadProgress ]) { progress.totalUnitCount = NSURLSessionTransferSizeUnknown; progress.cancellable = YES; progress.cancellationHandler = ^{ [weakTask cancel]; }; ... 无效,这就是导致崩溃的原因。不过,它似乎不是weakTask,因为无效地址是nil,而不仅仅是0x0000000000000010

有没有一种方法可以在使用之前验证弱引用?在将错误报告/修复提交给AFNetworking之前,我想尝试在本地修复它。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...