2014-09-23 84 views
-2

我的應用程序的時候纔來下面的代碼是低於當前崩潰:應用程序崩潰,而通過URL的iOS加載圖像

[cell.imgViewItem setImageWithURL:imageURL placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 
      NSLog(@"Finished"); 
     } usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 

下面是日誌跟蹤:

2014-09-23 14:11:05.353 SmartSwipe[2834:60b] -[UIImageView sd_cancelImageLoadOperationWithKey:]: unrecognized selector sent to instance 0x79c56ce0 
2014-09-23 14:11:05.502 SmartSwipe[2834:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView sd_cancelImageLoadOperationWithKey:]: unrecognized selector sent to instance 0x79c56ce0' 
*** First throw call stack: 
(
    0 CoreFoundation      0x034031e4 __exceptionPreprocess + 180 
    1 libobjc.A.dylib      0x031808e5 objc_exception_throw + 44 
    2 CoreFoundation      0x034a0243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275 
    3 CoreFoundation      0x033f350b ___forwarding___ + 1019 
    4 CoreFoundation      0x033f30ee _CF_forwarding_prep_0 + 14 
    5 SmartSwipe       0x0011c1a8 -[UIImageView(WebCache) sd_cancelCurrentImageLoad] + 56 
    6 SmartSwipe       0x00119744 -[UIImageView(WebCache) sd_setImageWithURL:placeholderImage:options:progress:completed:] + 276 
    7 SmartSwipe       0x0009cc18 -[UIImageView(UIActivityIndicatorForSDWebImage) setImageWithURL:placeholderImage:options:progress:completed:usingActivityIndicatorStyle:] + 504 
    8 SmartSwipe       0x0009c875 -[UIImageView(UIActivityIndicatorForSDWebImage) setImageWithURL:placeholderImage:completed:usingActivityIndicatorStyle:] + 229 
    9 SmartSwipe       0x0003f994 -[QuickScanViewController collectionView:cellForItemAtIndexPath:] + 948 
    10 UIKit        0x02395b30 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 257 
    11 UIKit        0x02397775 -[UICollectionView _updateVisibleCellsNow:] + 4730 
    12 UIKit        0x0239b65f -[UICollectionView layoutSubviews] + 265 
    13 UIKit        0x01dbe964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355 
    14 libobjc.A.dylib      0x0319282b -[NSObject performSelector:withObject:] + 70 
    15 QuartzCore       0x007a745a -[CALayer layoutSublayers] + 148 
    16 QuartzCore       0x0079b244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 
    17 QuartzCore       0x0079b0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 
    18 QuartzCore       0x007017fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294 
    19 QuartzCore       0x00702b85 _ZN2CA11Transaction6commitEv + 393 
    20 QuartzCore       0x00703258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92 
    21 CoreFoundation      0x033cb36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 
    22 CoreFoundation      0x033cb2bf __CFRunLoopDoObservers + 399 
    23 CoreFoundation      0x033a9254 __CFRunLoopRun + 1076 
    24 CoreFoundation      0x033a89d3 CFRunLoopRunSpecific + 467 
    25 CoreFoundation      0x033a87eb CFRunLoopRunInMode + 123 
    26 GraphicsServices     0x03f345ee GSEventRunModal + 192 
    27 GraphicsServices     0x03f3442b GSEventRun + 104 
    28 UIKit        0x01d4ff9b UIApplicationMain + 1225 
    29 SmartSwipe       0x001105bd main + 141 
    30 libdyld.dylib      0x04ec5701 start + 1 
    31 ???         0x00000001 0x0 + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 

請幫助我,我正在努力。提前致謝。

+0

什麼是'sd_cancelImageLoadOperationWithKey'? – trojanfoe 2014-09-23 08:45:16

回答

0

您已經編寫了一個調用方法sd_setImageWithURL,並且該方法針對不支持調用的UIImageView *調用sd_cancelCurrentImageLoad。檢查你實現sd_cancelCurrentImageLoad的源代碼以及它的功能。

-1

請在您的項目中添加SDWebImage框架。 您可以使用cocoapods,在pod文件中使用「pod」SDWebImage「'。

+1

他爲什麼要這樣做?嘗試添加一些解釋。 – m02ph3u5 2015-11-28 23:15:22

+0

因爲他正在使用的框架不存在。他正在使用SDWebImage加載圖像。 – 2016-04-06 14:15:35