Open KarrePrakash opened 8 years ago
Happens occasionally in my app too when accessing cached images:
Crashed: com.apple.root.default-qos
0 Haneke 0x1005bf24c @objc UIImage.hnk_imageByScalingToSize(CGSize) -> UIImage (UIImage+Haneke.swift:18)
1 Haneke 0x1005b2708 ImageResizer.resizeImage(UIImage) -> UIImage (Format.swift:90)
2 Haneke 0x1005c250c partial apply for static HanekeGlobals.UIKit.(formatWithSize(CGSize, scaleMode : ImageResizer.ScaleMode, allowUpscaling : Bool) -> Format
Did find any solution for this or work around ,really helps.
On 09-Jun-2016, at 6:29 PM, alexwheeller notifications@github.com wrote:
Happens occasionally in my app too when accessing cached images:
Crashed: com.apple.root.default-qos 0 Haneke 0x1005bf24c @objc https://github.com/objc UIImage.hnk_imageByScalingToSize(CGSize) -> UIImage (UIImage+Haneke.swift:18) 1 Haneke 0x1005b2708 ImageResizer.resizeImage(UIImage) -> UIImage (Format.swift:90) 2 Haneke 0x1005c250c partial apply for static HanekeGlobals.UIKit.(formatWithSize(CGSize, scaleMode : ImageResizer.ScaleMode, allowUpscaling : Bool) -> Format).(closure #1 https://github.com/Haneke/HanekeSwift/issues/1) (UIView+Haneke.swift) 3 Haneke 0x1005c2594 partial apply for thunk (UIView+Haneke.swift) 4 Haneke 0x1005b2250 Format.apply(A) -> A (Format.swift:30) 5 Haneke 0x1005a6344 Cache.((format in _5DD1881CA53F122A43CF7FA45732F8D2)(value : A, format : Format, success : (A) -> ()) -> ()).(closure #1 https://github.com/Haneke/HanekeSwift/issues/1) (Cache.swift:227) 6 Haneke 0x1005a4428 partial apply for Cache.((format in _5DD1881CA53F122A43CF7FA45732F8D2)(value : A, format : Format, success : (A) -> ()) -> ()).(closure #1 https://github.com/Haneke/HanekeSwift/issues/1) (Cache.swift) 7 libdispatch.dylib 0x1817c54bc _dispatch_call_block_and_release + 24 8 libdispatch.dylib 0x1817c547c _dispatch_client_callout + 16 9 libdispatch.dylib 0x1817d3914 _dispatch_root_queue_drain + 2140 10 libdispatch.dylib 0x1817d30b0 _dispatch_worker_thread3 + 112 11 libsystem_pthread.dylib 0x1819dd470 _pthread_wqthread + 1092 12 libsystem_pthread.dylib 0x1819dd020 start_wqthread + 4
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Haneke/HanekeSwift/issues/319#issuecomment-224886786, or mute the thread https://github.com/notifications/unsubscribe/ANRSRSu3QXCkuzv01zMlOy2ZPc9MDdcAks5qKA4_gaJpZM4IqPGl.
Exact same:
Crashed: com.apple.root.default-qos
0 Haneke 0x1007cf24c _TToFE6HanekeCSo7UIImage24hnk_imageByScalingToSizefVSC6CGSizeS0_ + 164
1 Haneke 0x1007c2710 _TFV6Haneke12ImageResizer11resizeImagefCSo7UIImageS1_ + 360
2 Haneke 0x1007d250c _TPA__TFZFVV6Haneke13HanekeGlobals5UIKit14formatWithSizeFTVSC6CGSize9scaleModeOVS_12ImageResizer9ScaleMode14allowUpscalingSb_GVS_6FormatCSo7UIImage_U_FS6_S6_ + 124
3 Haneke 0x1007d2594 _TPA__TTRXFo_oCSo7UIImage_oS__XFo_iS__iS__ + 64
4 Haneke 0x1007c2258 _TFV6Haneke6Format5applyfxx + 116
5 Haneke 0x1007b6314 _TFFC6Haneke5CacheP33_5DD1881CA53F122A43CF7FA45732F8D26formatFT5valuex6formatGVS_6Formatx_7successFxT__T_U_FT_T_ + 252
6 Haneke 0x1007b43f8 _TPA__TFFC6Haneke5CacheP33_5DD1881CA53F122A43CF7FA45732F8D26formatFT5valuex6formatGVS_6Formatx_7successFxT__T_U_FT_T_ + 164
7 libdispatch.dylib 0x182b854bc _dispatch_call_block_and_release + 24
8 libdispatch.dylib 0x182b8547c _dispatch_client_callout + 16
9 libdispatch.dylib 0x182b93914 _dispatch_root_queue_drain + 2140
10 libdispatch.dylib 0x182b930b0 _dispatch_worker_thread3 + 112
11 libsystem_pthread.dylib 0x182d9d470 _pthread_wqthread + 1092
12 libsystem_pthread.dylib 0x182d9d020 start_wqthread + 4
98 crashes/83 users in last 12 hours
Any update on this?
As the same
#0 0x000000010f3390ed in UIImage.hnk_imageByScalingToSize(CGSize) -> UIImage [inlined] at /Users/yangyouyong/Desktop/swiftvendor/Carthage/Checkouts/HanekeSwift/Haneke/UIImage+Haneke.swift:18
#1 0x000000010f3390ed in @objc UIImage.hnk_imageByScalingToSize(CGSize) -> UIImage ()
#2 0x000000010f327b41 in ImageResizer.resizeImage(UIImage) -> UIImage at /Users/yangyouyong/Desktop/swiftvendor/Carthage/Checkouts/HanekeSwift/Haneke/Format.swift:90
#3 0x000000010f31eaa4 in static HanekeGlobals.UIKit.(formatWithSize(CGSize, scaleMode : ImageResizer.ScaleMode, allowUpscaling : Bool) -> Format<UIImage>).(closure #1) [inlined] at /Users/yangyouyong/Desktop/swiftvendor/Carthage/Checkouts/HanekeSwift/Haneke/UIView+Haneke.swift:28
#4 0x000000010f31ea58 in partial apply for static HanekeGlobals.UIKit.(formatWithSize(CGSize, scaleMode : ImageResizer.ScaleMode, allowUpscaling : Bool) -> Format<UIImage>).(closure #1) ()
#5 0x000000010f31eb18 in thunk [inlined] ()
#6 0x000000010f31eb0f in partial apply for thunk ()
#7 0x000000010f32760d in Format.apply(A) -> A at /Users/yangyouyong/Desktop/swiftvendor/Carthage/Checkouts/HanekeSwift/Haneke/Format.swift:30
#8 0x000000010f33878a in Cache.((format in _5DD1881CA53F122A43CF7FA45732F8D2)(value : A, format : Format<A>, success : (A) -> ()) -> ()).(closure #1) at /Users/yangyouyong/Desktop/swiftvendor/Carthage/Checkouts/HanekeSwift/Haneke/Cache.swift:227
#9 0x000000010f3361f6 in partial apply for Cache.((format in _5DD1881CA53F122A43CF7FA45732F8D2)(value : A, format : Format<A>, success : (A) -> ()) -> ()).(closure #1) ()
#10 0x0000000111371d9d in _dispatch_call_block_and_release ()
#11 0x00000001113923eb in _dispatch_client_callout ()
#12 0x000000011137ab2f in _dispatch_root_queue_drain ()
#13 0x000000011137a405 in _dispatch_worker_thread3 ()
#14 0x00000001116e6746 in _pthread_wqthread ()
#15 0x00000001116e6221 in start_wqthread ()
Same issue here for hnk_setImage and hnk_setImageFromFile
My experience is that: HNK requires that your UIImageView or button has a non-zero CGSize at the time of setting image so the ImageResizer can use the size to do resizing work. You can get avoid the crash by initializing the ImageView with a default size in a closure. Then you can add autolayout constraints or use other method to layout.
class UserTableViewCell: BaseTableViewCell {
lazy var avatar: UIImageView = {
let iv = UIImageView()
iv.frame = CGRect(origin: .zero, size: CGSize(width: 30, height: 30))
iv.contentMode = .scaleAspectFill
iv.clipsToBounds = true
return iv
}()
}
Crashed: com.apple.root.default-qos 0 Haneke 0x100e0b070 _TToFE6HanekeCSo7UIImage24hnk_imageByScalingToSizefS0FVSC6CGSizeS0 + 164 1 Haneke 0x100dfdef4 _TFV6Haneke12ImageResizer11resizeImagefS0FCSo7UIImageS1 + 360 2 Haneke 0x100e0e7a0 _TPATFZFVV6Haneke13HanekeGlobals5UIKit14formatWithSizeFMS1_FTVSC6CGSize9scaleModeOVS_12ImageResizer9ScaleMode14allowUpscalingSb_GVS_6FormatCSo7UIImage_U_FS6S6 + 124 3 Haneke 0x100e0e828 _TPATTRXFo_oCSo7UIImage_oSXFo_iSiS + 64 4 Haneke 0x100dfdb04 _TFV6Haneke6Format5applyurfGS0_qFqq + 120 5 Haneke 0x100df0c9c _TFFC6Haneke5CacheP33_5DD1881CA53F122A43CF7FA45732F8D26formatuRq_S_15DataConvertibleq_S_17DataRepresentablezq_qq_S1_6Result_FGS0_qFT5valueq_6formatGVS_6Formatq7successFq_TT_U_FTT + 236 6 Haneke 0x100dee540 _TPATFFC6Haneke5CacheP33_5DD1881CA53F122A43CF7FA45732F8D26formatuRq_S_15DataConvertibleq_S_17DataRepresentablezq_qq_S1_6Result_FGS0_qFT5valueq_6formatGVS_6Formatq__7successFq_TT_U_FTT + 176 7 libdispatch.dylib 0x1810c54bc _dispatch_call_block_and_release + 24 8 libdispatch.dylib 0x1810c547c _dispatch_client_callout + 16 9 libdispatch.dylib 0x1810d3914 _dispatch_root_queue_drain + 2140 10 libdispatch.dylib 0x1810d30b0 _dispatch_worker_thread3 + 112 11 libsystem_pthread.dylib 0x1812dd470 _pthread_wqthread + 1092 12 libsystem_pthread.dylib 0x1812dd020 start_wqthread + 4