0
votes

Here is the line of code

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

Here is the error trace

[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

And the property in question is

@property(strong,nonatomic) NSURL *imageURL;

with setter

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

The strange thing is this used to work and about an hour or so ago it stops working and starts throwing this exception.

update

- (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;
}
1
cell is a UITableViewCell and not an instance of your custom cell class.rmaddy
Can you add your cellForRowAtIndexPath: here. It looks ok for me.Ryan
@rmaddy you may be correct because my logging says that the cell is indeed <UITableViewCell: 0x8ddc470; frame = (0 0; 320 385); autoresize = W; layer = <CALayer: 0x8ddc600>> but I don't see how that is possible.Katedral Pillon
You need to be sure that you register your custom cell class and not UITableViewCell.rmaddy

1 Answers

2
votes

The error is because your cell is actually a UITableViewCell instance and not an instance of your custom cell class.

Be sure to register your custom cell class for the cell.