我正在跟随Hockey App崩溃
Thread 0 Crashed:
0 App 0x000000010302e7f8 partial apply forwarder for closure #1 (__C.UIImage?, [Swift.AnyHashable : Any]?) -> () in static App.ImageLoader.image(from: __C.PHAsset, size: __C_Synthesized.CGSize, success: (__C.UIImage) -> ()) -> () (PhotoLibraryImageLoader.swift:28)
1 App 0x000000010302d958 reabstraction thunk helper from @escaping @callee_guaranteed (@owned __C.UIImage?, @owned [Swift.AnyHashable : Any]?) -> () to @escaping @callee_unowned @convention(block) (@unowned __C.UIImage?, @unowned __C.NSDictionary?) -> () (PhotoLibraryImageLoader.swift:0)
2 Photos 0x00000001917c89cc __84-[PHImageManager requestImageForAsset:targetSize:contentMode:options:resultHandler:]_block_invoke.1505 + 816
在PhotoLibraryImageLoader.swift中
static func image(from assest:PHAsset,size:CGSize,success:@escaping (_ image:UIImage) -> Void) {
let option = PHImageRequestOptions()
option.isSynchronous = false
option.deliveryMode = .highQualityFormat
PHImageManager.default().requestImage(for: assest, targetSize: size, contentMode: .aspectFill, options: option) { (image, attributes) in
success(image!) // Crash line PhotoLibraryImageLoader.swift:28
}
}
如果存在可选(image!
)崩溃日志的问题,则该日志应该有所不同(类似意外发现的零。)
这是什么意思?部分关闭申请转发器
任何人都可以帮助我了解一下吗?
答案 0 :(得分:0)
我认为这次崩溃是由于有充分的参考依据。您是否在完成块中调用任何已释放的对象?
如果需要,在完成处理程序中使用以下检查。
if let wSelf = self {
println("i have image now")
// do what you want with the image/self
}
答案 1 :(得分:0)
无法使用的图片导致崩溃(需要从服务器下载)
为此,请在选项中添加一行
option.isNetworkAccessAllowed = true
希望对某人有帮助