1

大家好,我已经集成了 SDWebImage 用于从 Facebook 加载图像。在模拟器上一切正常,但是当我尝试在设备上运行时出现错误:

B'dayReminderPlus[415:307] -[UIImageView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x4f7d310

2012-08-17 14:45:15.301 B'dayReminderPlus[415:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x4f7d310'

*** Call stack at first throw:

(

0   CoreFoundation                      0x3759dc7b __exceptionPreprocess + 114
1   libobjc.A.dylib                     0x32d9bee8 objc_exception_throw + 40
2   CoreFoundation                      0x3759f3e3 -[NSObject(NSObject) doesNotRecognizeSelector:] + 98
3   CoreFoundation                      0x37544467 ___forwarding___ + 506
4   CoreFoundation                      0x37544220 _CF_forwarding_prep_0 + 48
5   B'dayReminderPlus                   0x000213e9 -[DLFirstScreenViewController tableView:cellForRowAtIndexPath:] + 5012
6   UIKit                               0x359600a0 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 668
7   UIKit                               0x3595fdcc -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 52
8   UIKit                               0x3595db84 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1308
9   UIKit                               0x3595c838 -[UITableView layoutSubviews] + 208
10  UIKit                               0x358ec70c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 40
11  CoreFoundation                      0x37538f79 -[NSObject(NSObject) performSelector:withObject:] + 24
12  QuartzCore                          0x33d9a130 -[CALayer layoutSublayers] + 184
13  QuartzCore                          0x33d99db8 CALayerLayoutIfNeeded + 200
14  QuartzCore                          0x33d917c0 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 268
15  QuartzCore                          0x33d91518 _ZN2CA11Transaction6commitEv + 284
16  QuartzCore                          0x33dc3c28 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 88
17  CoreFoundation                      0x3752a80f __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
18  CoreFoundation                      0x3752a63d __CFRunLoopDoObservers + 500
19  CoreFoundation                      0x3752199d __CFRunLoopRun + 940
20  CoreFoundation                      0x3752150b CFRunLoopRunSpecific + 226
21  CoreFoundation                      0x37521419 CFRunLoopRunInMode + 60
22  GraphicsServices                    0x33e76d24 GSEventRunModal + 196
23  UIKit                               0x3591d57c -[UIApplication _run] + 588
24  UIKit                               0x3591a558 UIApplicationMain + 972
25  B'dayReminderPlus                   0x00002703 main + 106
26  B'dayReminderPlus                   0x00002694 start + 40

)

terminate called after throwing an instance of ‘NSException’

这次崩溃即将发生:[cell.contactImageView setImageWithURL:[NSURL URLWithString:[[contactList objectAtIndex:indexPath.row] objectForKey:PICTURE_KEY]]placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

我不清楚为什么在模拟器上运行 APP 时会发生这种崩溃。任何帮助,将不胜感激。提前谢谢。

4

1 回答 1

1

在设备上运行时我也遇到了这个问题。我忘记在“其他链接器标志”设置中添加“-Objc”标志。

添加链接器标志

打开“Build Settings”选项卡,在“Linking”部分,找到“Other Linker Flags”设置并添加“-ObjC”标志:

于 2013-08-02T04:28:50.287 回答