5

So, i've just updated my xcode and started building my app for iOS 7.1. But now i find out that my SDWebImage is broken. Whenever i try to set an ImageWithUrl for a UIImageView my app crashes with the following exception and stacktrace:

2014-03-11 12:55:36.647 Wiggle[1983:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setImageWithURL:placeholderImage:options:]: unrecognized selector sent to instance 0x10fa12890'


*** First throw call stack:
(
    0   CoreFoundation                      0x0000000103188795 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000102eeb991 objc_exception_throw + 43
    2   CoreFoundation                      0x0000000103219bad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000010317a09d ___forwarding___ + 973
    4   CoreFoundation                      0x0000000103179c48 _CF_forwarding_prep_0 + 120
    5   Wiggle                              0x000000010001fe94 -[MenuTableViewController tableView:viewForHeaderInSection:] + 1316
    6   UIKit                               0x000000010182cdb3 __84-[UITableView _sectionHeaderView:withFrame:forSection:floating:reuseViewIfPossible:]_block_invoke + 112
    7   UIKit                               0x00000001017b60ac +[UIView(Animation) performWithoutAnimation:] + 70
    8   UIKit                               0x000000010182ccc5 -[UITableView _sectionHeaderView:withFrame:forSection:floating:reuseViewIfPossible:] + 223
    9   UIKit                               0x00000001018149cf -[UITableView _updateVisibleHeadersAndFootersNow:] + 2596
    10  UIKit                               0x0000000101815b6f -[UITableView _updateVisibleCellsNow:] + 3122
    11  UIKit                               0x0000000101826381 -[UITableView layoutSubviews] + 207
    12  UIKit                               0x00000001017bdb27 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 354
    13  QuartzCore                          0x0000000100bb7a22 -[CALayer layoutSublayers] + 151
    14  QuartzCore                          0x0000000100bac589 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 363
    15  QuartzCore                          0x0000000100bac40a _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    16  QuartzCore                          0x0000000100b21694 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 252
    17  QuartzCore                          0x0000000100b2270c _ZN2CA11Transaction6commitEv + 394
    18  UIKit                               0x0000000101779444 _afterCACommitHandler + 128
    19  CoreFoundation                      0x0000000103153ff7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    20  CoreFoundation                      0x0000000103153f67 __CFRunLoopDoObservers + 391
    21  CoreFoundation                      0x00000001031336d2 __CFRunLoopRun + 946
    22  CoreFoundation                      0x0000000103132f33 CFRunLoopRunSpecific + 467
    23  GraphicsServices                    0x00000001036a53a0 GSEventRunModal + 161
    24  UIKit                               0x0000000101762043 UIApplicationMain + 1010

I'm not sure what to do, can anybody help?

Daan Olislagers
  • 3,253
  • 2
  • 17
  • 35
  • Have you imported `UIImageView+WebCache.h` category header in your code and added `-ObjC` in **Other Linker Flags**? – Amar Mar 11 '14 at 12:10
  • Absolutely, everything works fine if I build my app for SDK 7.0. It also works on iOS 7.1. But if I set my Base SDK to 7.1 the app crashes. – Daan Olislagers Mar 11 '14 at 12:13
  • 1
    Are you building your project for `arm64` as well? If yes try excluding `arm64` architecture once. Also are you adding `SDWebImage` as subproject or a static library `.a` file? – Amar Mar 11 '14 at 12:16
  • Thank you that fixed it! I had to set the Build Active Architectures Only to NO in my project and my pods as well. – Daan Olislagers Mar 11 '14 at 12:30
  • Glad I could help. You can answer your question with the fix you did so that it can help others. – Amar Mar 11 '14 at 12:31

2 Answers2

10

Thanks to Amar I found the answer.

SDWebImage with Base SDK iOS 7.1 requires you to exclude arm64 in

Project > BuildSettings > Architectures> Valid Architectures.

You might also need to set Build Active Architectures Only to NO for it to work.

Raptor
  • 53,206
  • 45
  • 230
  • 366
Daan Olislagers
  • 3,253
  • 2
  • 17
  • 35
1

Obviously now that there are lots of 64 bit devices out there you don't want to do this anymore, you instead want to download the latests SDWeb library that is compatible with the new architecture.

Ali
  • 18,665
  • 21
  • 103
  • 138