2014-07-25 7 views
0
여기

오류 추적NSURL 인식 할 수없는 선택기

[UITableViewCell setImageURL:]: unrecognized selector sent to instance 0x906da70 
2014-07-24 17:16:50.049 MyApp_iOS[9443:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCell setImageURL:]: unrecognized selector sent to instance 0x906da70' 
*** First throw call stack: 
(
    0 CoreFoundation      0x01a8c1e4 __exceptionPreprocess + 180 
    1 libobjc.A.dylib      0x016ad8e5 objc_exception_throw + 44 
    2 CoreFoundation      0x01b29243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275 
    3 CoreFoundation      0x01a7c50b ___forwarding___ + 1019 
    4 CoreFoundation      0x01a7c0ee _CF_forwarding_prep_0 + 14 
    5 MyApp_iOS       0x0007f518 -[BCDDogViewController tableView:cellForRowAtIndexPath:] + 504 
    6 UIKit        0x0046611f -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 412 
    7 UIKit        0x004661f3 -[UITableView _createPreparedCellForGlobalRow:] + 69 
    8 UIKit        0x00447ece -[UITableView _updateVisibleCellsNow:] + 2428 
    9 UIKit        0x0045c6a5 -[UITableView layoutSubviews] + 213 
    10 UIKit        0x003dc964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355 
    11 libobjc.A.dylib      0x016bf82b -[NSObject performSelector:withObject:] + 70 
    12 QuartzCore       0x03ef745a -[CALayer layoutSublayers] + 148 
    13 QuartzCore       0x03eeb244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 
    14 QuartzCore       0x03eeb0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 
    15 QuartzCore       0x03e517fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294 
    16 QuartzCore       0x03e52b85 _ZN2CA11Transaction6commitEv + 393 
    17 QuartzCore       0x03e53258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92 
    18 CoreFoundation      0x01a5436e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 
    19 CoreFoundation      0x01a542bf __CFRunLoopDoObservers + 399 
    20 CoreFoundation      0x01a32254 __CFRunLoopRun + 1076 
    21 CoreFoundation      0x01a319d3 CFRunLoopRunSpecific + 467 
    22 CoreFoundation      0x01a317eb CFRunLoopRunInMode + 123 
    23 GraphicsServices     0x03a805ee GSEventRunModal + 192 
    24 GraphicsServices     0x03a8042b GSEventRun + 104 
    25 UIKit        0x0036df9b UIApplicationMain + 1225 
    26 MyApp_iOS       0x000577c2 main + 130 
    27 libdyld.dylib      0x0216d701 start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 

그리고 문제의 속성 코드 여기

cell.imageURL=[NSURL URLWithString:self.imageURLs[indexPath.row]]; 

의 라인 세터

@property(strong,nonatomic) NSURL *imageURL; 

임 인스턴스로 전송

-(void)setImageURL:(NSURL *)imageURL 
{ 
    _imageURL=imageURL; 
    [self startDownloadingImage]; 
} 

이상한 것은이 작업에 사용되며 약 1 시간 정도 전에 작동을 멈추고이 예외를 던지기 시작합니다. 당신의 세포가 실제로 UITableViewCell 인스턴스 아닌 사용자 정의 셀 클래스의 인스턴스이기 때문에

갱신

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    BCDDogImageTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[BCDDogImageTableViewCell cellPrototypeIdentifier] forIndexPath:indexPath]; 
    NSLog(@"THE CELL IS: %@ ", cell); 
    cell.imageURL=[NSURL URLWithString:self.imageURLs[indexPath.row]]; 
    return cell; 
} 
+2

'cell'은 사용자 정의 셀 클래스의 인스턴스가 아니라'UITableViewCell'입니다. – rmaddy

+0

여기에'cellForRowAtIndexPath :'를 추가 할 수 있습니까? 그것은 나를 위해 괜찮아 보인다. – Ryan

+0

@rmaddy 제 로깅에서 셀이 실제로는 > "하지만 어떻게 가능하지는 않습니다. –

답변

2

오류입니다.

셀의 사용자 정의 셀 클래스를 등록하십시오.