【问题标题】:Couldn't understand crash log partial apply forwarder for closure #1无法理解崩溃日志部分应用转发器以关闭 #1
【发布时间】:2018-09-18 04:56:13
【问题描述】:

我在使用 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!) 崩溃日志存在问题,则应该不同(类似于意外发现 nil..)

这里是什么意思部分申请转发器关闭

任何人都可以帮助我了解它吗?

【问题讨论】:

  • 嗨,你有什么解决办法吗?
  • @Kakumanusivakrishna 是 option.isSynchronous = false option.isNetworkAccessAllowed = true 添加为答案

标签: ios swift crash-reports


【解决方案1】:

图片不可用导致崩溃(需要从服务器下载)

为此在选项中添加一行

    option.isNetworkAccessAllowed = true

希望对大家有帮助

【讨论】:

    【解决方案2】:

    我认为崩溃是由于强参考造成的。您是否在完成块中调用任何已发布的对象?

    如果需要,在完成处理程序中使用以下检查。

    if let wSelf = self {
        println("i have image now")
        // do what you want with the image/self
    }
    

    【讨论】:

    • 但它是静态函数,所以不允许使用,因为public final class ImageLoader : NSObject
    猜你喜欢
    • 2017-09-11
    • 2013-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多