I created a separate UITableViewCell and designed it using .xib file and it looks like
My header file for UITableViewCell looks like
#interface MenuTableViewCell : UITableViewCell
#property(nonatomic, weak) IBOutlet UIImageView *menuImage;
#property(nonatomic, weak) IBOutlet UILabel *menuLabel;
#end
and both properties are connected
I tried to use it in my MenuViewController as
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
MenuTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.menuImage.image = [self getImageNameForRow:indexPath.row];
cell.menuLabel.text = self.features[(NSUInteger) indexPath.row];
return cell;
}
and
- (UIImage *)getImageNameForRow:(NSInteger)row {
if (row == 0) {
return [UIImage imageNamed:#"Transaction"];
}
if (row == 1) {
return [UIImage imageNamed:#"Summary"];
}
return [UIImage imageNamed:#"Budget"];
}
when I run my application, it crashes and shows the following on log
2014-08-30 14:51:54.387 pennyapp-ios[37988:70b] -[UITableViewCell menuImage]: unrecognized selector sent to instance 0x10bb1e5e0
2014-08-30 14:51:54.389 pennyapp-ios[37988:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCell menuImage]: unrecognized selector sent to instance 0x10bb1e5e0'
*** First throw call stack:
(
0 CoreFoundation 0x00000001023c6495 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010212599e objc_exception_throw + 43
2 CoreFoundation 0x000000010245765d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001023b7d8d ___forwarding___ + 973
4 CoreFoundation 0x00000001023b7938 _CF_forwarding_prep_0 + 120
5 pennyapp-ios 0x00000001000044ed -[MenuTableViewController tableView:cellForRowAtIndexPath:] + 141
6 UIKit 0x0000000100904f8a -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 348
7 UIKit 0x00000001008ead5b -[UITableView _updateVisibleCellsNow:] + 2337
8 UIKit 0x00000001008fc721 -[UITableView layoutSubviews] + 207
9 UIKit 0x0000000100890993 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 354
10 QuartzCore 0x0000000104fbc802 -[CALayer layoutSublayers] + 151
11 QuartzCore 0x0000000104fb1369 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 363
12 QuartzCore 0x0000000104fb11ea _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
13 QuartzCore 0x0000000104f24fb8 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 252
14 QuartzCore 0x0000000104f26030 _ZN2CA11Transaction6commitEv + 394
15 UIKit 0x0000000100848e25 _afterCACommitHandler + 128
16 CoreFoundation 0x0000000102391dc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
17 CoreFoundation 0x0000000102391d37 __CFRunLoopDoObservers + 391
18 CoreFoundation 0x0000000102371522 __CFRunLoopRun + 946
19 CoreFoundation 0x0000000102370d83 CFRunLoopRunSpecific + 467
20 GraphicsServices 0x00000001036e3f04 GSEventRunModal + 161
21 UIKit 0x0000000100830e33 UIApplicationMain + 1010
22 pennyapp-ios 0x0000000100001353 main + 115
23 libdyld.dylib 0x00000001033655fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I am very new to iOS and can't understand the error message, can some one please help me knowing what am In doing wrong?
There were 2 problems.
I was registering UITableViewCell instead of MenuTableViewCell
I was not registering the nib file I had
After making the change as following things, started to work again.
[self.tableView registerNib:[UINib nibWithNibName:#"MenuTableViewCell" bundle:nil] forCellReuseIdentifier:CellIdentifier];
Thank you for all your answers, they helped me a lot!
Declare an imgearray in interface,then add your array of images,next cellforatindexpath add code for UIImageView
yourcellname.yourimagename.image=[UIImage imagenamed:[yourimagearray objectAtIndexPath.row]];
Related
I have a static UItableView. In one of the cells, I have a dynamic prototype UITableView. Here is the code I implemented:
In viewDidLoad:
self.tagsArray = [[NSArray alloc] initWithObjects:#"hey", #"what", #"ola", #"dada", #"hoster", #"umi", nil];
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return self.tableView == tableView ? 2 : 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (self.tableView == tableView)
return (section == 0) ? 3 : 2;
else
return [self.tagsArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell;
if (self.tableView == tableView) {
cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
}
else {
cell = [tableView dequeueReusableCellWithIdentifier:#"cell" forIndexPath:indexPath];
[cell.textLabel setText:self.tagsArray [indexPath.row]];
}
return cell;
}
When I run the app, everything works fine. But when I start scrolling on the inner tableView (the dynamic prototype one), then I get the following error:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 3 beyond bounds [0 .. 2]'
*** First throw call stack:
(
0 CoreFoundation 0x00000001012a7c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000100f40bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010119e17e -[__NSArrayI objectAtIndex:] + 190
3 UIKit 0x0000000101e12132 -[UITableViewDataSource tableView:indentationLevelForRowAtIndexPath:] + 106
4 UIKit 0x00000001019dc1f9 __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 1711
5 UIKit 0x000000010195a68e +[UIView(Animation) performWithoutAnimation:] + 65
6 UIKit 0x00000001019dbb3b -[UITableView _configureCellForDisplay:forIndexPath:] + 312
7 UIKit 0x00000001019e3a41 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 533
8 UIKit 0x00000001019c2248 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2853
9 UIKit 0x00000001019d88a9 -[UITableView layoutSubviews] + 210
10 UIKit 0x0000000101962a2b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
11 QuartzCore 0x0000000100934ec2 -[CALayer layoutSublayers] + 146
12 QuartzCore 0x00000001009296d6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
13 QuartzCore 0x0000000100929546 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
14 QuartzCore 0x0000000100895886 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
15 QuartzCore 0x0000000100896a3a _ZN2CA11Transaction6commitEv + 462
16 QuartzCore 0x00000001008970eb _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
17 CoreFoundation 0x00000001011daca7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
18 CoreFoundation 0x00000001011dac00 __CFRunLoopDoObservers + 368
19 CoreFoundation 0x00000001011d0a33 __CFRunLoopRun + 1123
20 CoreFoundation 0x00000001011d0366 CFRunLoopRunSpecific + 470
21 GraphicsServices 0x000000010510da3e GSEventRunModal + 161
22 UIKit 0x00000001018e2900 UIApplicationMain + 1282
23 myApp 0x00000001004cf51f main + 111
24 libdyld.dylib 0x0000000102cfe145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I don't know what the above error means, but I think that it's not creating new cells for some reason, and because of that, it has a conflict with the number of cells to display, so it crashes with the above error.
Why isn't the inner tableView creating new cells, and what can I do to fix it?
What the error is telling you is that you tried to access an element that doesn't exist.
Your data array only has 2 elements, but you are hardcoding the amount of cells you want to create (3) so when it looks for the 3rd element to create the cell it crashes because is not existent.
my code is:
- (void) tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath{
if (editingStyle == UITableViewCellEditingStyleDelete){
/* First remove this object from the source */
[self.allRows removeObjectAtIndex:indexPath.row];
/* Then remove the associated cell from the Table View */
[tableView deleteRowsAtIndexPaths:#[indexPath]
withRowAnimation:UITableViewRowAnimationFade];
}
}
i am getting error as follows
2015-02-16 11:57:32.413 SimpleTable[1590:45462] -[ViewController refreshControl]: unrecognized selector sent to instance 0x7fa1d2d936c0
2015-02-16 11:57:32.415 SimpleTable[1590:45462] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController refreshControl]: unrecognized selector sent to instance 0x7fa1d2d936c0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d738f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010d3d1bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010d74004d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010d69827c ___forwarding___ + 988
4 CoreFoundation 0x000000010d697e18 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010db268be -[UIApplication sendAction:to:from:forEvent:] + 75
6 UIKit 0x000000010db268be -[UIApplication sendAction:to:from:forEvent:] + 75
7 UIKit 0x000000010dc2d410 -[UIControl _sendActionsForEvents:withEvent:] + 467
8 UIKit 0x000000010dc2c7df -[UIControl touchesEnded:withEvent:] + 522
9 UIKit 0x000000010db6c308 -[UIWindow _sendTouchesForEvent:] + 735
10 UIKit 0x000000010db6cc33 -[UIWindow sendEvent:] + 683
11 UIKit 0x000000010db399b1 -[UIApplication sendEvent:] + 246
12 UIKit 0x000000010db46a7d _UIApplicationHandleEventFromQueueEvent + 17370
13 UIKit 0x000000010db22103 _UIApplicationHandleEventQueue + 1961
14 CoreFoundation 0x000000010d66e551 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
15 CoreFoundation 0x000000010d66441d __CFRunLoopDoSources0 + 269
16 CoreFoundation 0x000000010d663a54 __CFRunLoopRun + 868
17 CoreFoundation 0x000000010d663486 CFRunLoopRunSpecific + 470
18 GraphicsServices 0x0000000110d079f0 GSEventRunModal + 161
19 UIKit 0x000000010db25420 UIApplicationMain + 1282
20 SimpleTable 0x000000010cea27d3 main + 115
21 libdyld.dylib 0x000000010fcc8145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I think your TableView may be getting released after you create it and the method ends. You probably need to create an instance variable inside in View controller that references it.
#property (strong, nonatomic) IBOutlet UITableView *tablview;
Then remove the associated cell from the Table View
[self.tablview deleteRowsAtIndexPaths:#[indexPath]
withRowAnimation:UITableViewRowAnimationFade];
May help you..
Try this
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
//remove the row from data model
[tableData removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:#[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
I have an iOS app that has been working quite well in two languages – I know added some stuff, already keeping in mind using NSLocalizedString for localization etc. The english version of the app works fine so far, but the second language version crashes right after starting. Why?
One should note that I have not added all NSLocalizedStrings in my localizable.strings file. Furthermore, I have two separate Storyboards for both english an german. Any help would be greatly appreciated!
2014-12-18 18:14:36.083 Coverdale[48297:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 1]'
*** First throw call stack:
(
0 CoreFoundation 0x002461e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x020538e5 objc_exception_throw + 44
2 CoreFoundation 0x001fa8b2 -[__NSArrayI objectAtIndex:] + 210
3 UIKit 0x0126a35f -[UITableViewDataSource tableView:indentationLevelForRowAtIndexPath:] + 127
4 UIKit 0x00fe3f34 -[UITableViewController tableView:indentationLevelForRowAtIndexPath:] + 61
5 UIKit 0x00e012cf __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 1786
6 UIKit 0x00d7581f +[UIView(Animation) performWithoutAnimation:] + 82
7 UIKit 0x00d75868 +[UIView(Animation) _performWithoutAnimation:] + 40
8 UIKit 0x00e00bd0 -[UITableView _configureCellForDisplay:forIndexPath:] + 108
9 UIKit 0x00e0813d -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 442
10 UIKit 0x00e081f3 -[UITableView _createPreparedCellForGlobalRow:] + 69
11 UIKit 0x00de9ece -[UITableView _updateVisibleCellsNow:] + 2428
12 UIKit 0x00dfe6a5 -[UITableView layoutSubviews] + 213
13 UIKit 0x00d7e964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
14 libobjc.A.dylib 0x0206582b -[NSObject performSelector:withObject:] + 70
15 QuartzCore 0x007c845a -[CALayer layoutSublayers] + 148
16 QuartzCore 0x007bc244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
17 QuartzCore 0x007bc0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
18 QuartzCore 0x007227fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
19 QuartzCore 0x00723b85 _ZN2CA11Transaction6commitEv + 393
20 QuartzCore 0x00724258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
21 CoreFoundation 0x0020e36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
22 CoreFoundation 0x0020e2bf __CFRunLoopDoObservers + 399
23 CoreFoundation 0x001ec254 __CFRunLoopRun + 1076
24 CoreFoundation 0x001eb9d3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x001eb7eb CFRunLoopRunInMode + 123
26 GraphicsServices 0x0406b5ee GSEventRunModal + 192
27 GraphicsServices 0x0406b42b GSEventRun + 104
28 UIKit 0x00d0ff9b UIApplicationMain + 1225
29 Coverdale 0x0009b95d main + 141
30 libdyld.dylib 0x028b9701 start + 1
31 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
EDIT
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = #"Error";
if (indexPath.section == 0) {
if(indexPath.row == 0)
{ /*..*/}
}
return cell;
}
Turns out I needed to implement indentationLevelForRowAtIndexPath and just return 0.
I've been trying to solve this problem for the past two days but I just can't find why it occurs, so I took it here to ask if you guys have any idea about it.
So I have a UITableView which I display some items in. I also have a UITableViewCell which I use as the cells.
I register the nib with my table view in the viewDidLoad:
[self.QuickPickDetailsTV registerNib:[UINib nibWithNibName:#"QuickPickItemCell"
bundle:[NSBundle mainBundle]]
forCellReuseIdentifier:#"QuickPickItemCellReuseID"];
Then in the tableView:cellForRowAtIndexPath:, I reuse, populate, and return the cell as below:
static NSString *CellIdentifier = #"QuickPickItemCellReuseID";
QuickPickItemCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[QuickPickItemCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
NSDictionary *quickPickItem = [self.myQuickPickItems objectAtIndex:indexPath.row];
NSString *theQuickPickItemName = [quickPickItem valueForKey:#"name"];
[cell.mName setFont:[UIFont fontWithName:#"OpenSans" size:16]];
[cell.mName setText:NSLocalizedString(theQuickPickItemName, nil)];
return cell;
The method above gets called for the number of items it should display (as expected), and crashes with an strange error after the last cell is returned:
2014-08-02 13:03:38.008 TestApp[49701:607] -[__NSArrayI length]: unrecognized selector sent to instance 0x2e92fde0
2014-08-02 13:03:38.010 TestApp[49701:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI length]: unrecognized selector sent to instance 0x2e92fde0'
*** First throw call stack:
(
0 CoreFoundation 0x044f21e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x033888e5 objc_exception_throw + 44
2 CoreFoundation 0x0458f243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x044e250b ___forwarding___ + 1019
4 CoreFoundation 0x044e20ee _CF_forwarding_prep_0 + 14
5 UIKit 0x01ff8463 -[UILabel _shadow] + 45
6 UIKit 0x01ff98c2 -[UILabel drawTextInRect:] + 70
7 UIKit 0x01ffbdfc -[UILabel drawRect:] + 98
8 UIKit 0x01eaa453 -[UIView(CALayerDelegate) drawLayer:inContext:] + 504
9 QuartzCore 0x00dbaf39 -[CALayer drawInContext:] + 123
10 QuartzCore 0x00dbae6a _ZL16backing_callbackP9CGContextPv + 96
11 QuartzCore 0x00ca94fc CABackingStoreUpdate_ + 2656
12 QuartzCore 0x00dbae02 ___ZN2CA5Layer8display_Ev_block_invoke + 93
13 QuartzCore 0x00def2d7 x_blame_allocations + 15
14 QuartzCore 0x00dbac6d _ZN2CA5Layer8display_Ev + 1519
15 QuartzCore 0x00dbaeb9 -[CALayer _display] + 33
16 QuartzCore 0x00dba676 _ZN2CA5Layer7displayEv + 144
17 QuartzCore 0x00dbae93 -[CALayer display] + 33
18 QuartzCore 0x00daf043 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 323
19 QuartzCore 0x00daf0bc _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 38
20 QuartzCore 0x00d157fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
21 QuartzCore 0x00d16b85 _ZN2CA11Transaction6commitEv + 393
22 QuartzCore 0x00d17258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
23 CoreFoundation 0x044ba36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
24 CoreFoundation 0x044ba2bf __CFRunLoopDoObservers + 399
25 CoreFoundation 0x04498254 __CFRunLoopRun + 1076
26 CoreFoundation 0x044979d3 CFRunLoopRunSpecific + 467
27 CoreFoundation 0x044977eb CFRunLoopRunInMode + 123
28 GraphicsServices 0x047e95ee GSEventRunModal + 192
29 GraphicsServices 0x047e942b GSEventRun + 104
30 UIKit 0x01e3bf9b UIApplicationMain + 1225
31 TestApp 0x00002c92 main + 130
32 TestApp 0x00002c05 start + 53
33 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I have searched all my code but I don't send length to any object in my code. I don't know where is the crash coming from since it is shown to be on my main.m.
I have tried turning on NSZombies as well, but I didn't get any warnings about released objects.
Any help will be appreciated!
Thanks
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;
}
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.