My application crashing ans showing following in console. How to remove this exception???
2011-11-25 17:47:56.519 ShowroomLocator[1482:707] -[ShowroomLocatorViewController length]: unrecognized selector sent to instance 0x164860
2011-11-25 17:47:56.541 ShowroomLocator[1482:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [ShowroomLocatorViewController length]: unrecognized selector sent to instance 0x164860'
*** Call stack at first throw:
(
0 CoreFoundation 0x308aa64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3400bc5d objc_exception_throw + 24
2 CoreFoundation 0x308ae1bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x308ad649 ___forwarding___ + 508
4 CoreFoundation 0x30824180 _CF_forwarding_prep_0 + 48
5 UIKit 0x35dcfed1 - [UITableView(UITableViewInternal) _delegateWantsHeaderForSection:] + 228
6 UIKit 0x35dcf2db -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 78
7 UIKit 0x35dcf225 -[UITableViewRowData numberOfRows] + 72
8 UIKit 0x35dcec73 -[UITableView noteNumberOfRowsChanged] + 82
9 UIKit 0x35dce7f7 -[UITableView reloadData] + 582
10 HettichShowroomLocator 0x00003487 - [ShowroomLocatorViewController viewWillAppear:] + 50
11 UIKit 0x35dbf1d9 -[UIViewController viewWillMoveToWindow:] + 64
12 UIKit 0x35d9e179 -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 132
13 UIKit 0x35d83a59 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 228
14 UIKit 0x35d8396b -[UIView(Hierarchy) addSubview:] + 22
15 UIKit 0x35db335f -[UIWindow addRootViewControllerViewIfPossible] + 202
16 UIKit 0x35daf333 -[UIWindow _setHidden:forced:] + 182
17 UIKit 0x35db328f -[UIWindow _orderFrontWithoutMakingKey] + 18
18 UIKit 0x35dc1c61 -[UIWindow makeKeyAndVisible] + 16
19 ShowroomLocator 0x0000285b - [ShowroomLocatorAppDelegate application:didFinishLaunchingWithOptions:] + 162
20 UIKit 0x35db3821 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 772
21 UIKit 0x35dadb65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
22 UIKit 0x35d827d7 -[UIApplication handleEvent:withNewEvent:] + 1114
23 UIKit 0x35d82215 -[UIApplication sendEvent:] + 44
24 UIKit 0x35d81c53 _UIApplicationHandleEvent + 5090
25 GraphicsServices 0x35a56e77 PurpleEventCallback + 666
26 CoreFoundation 0x30881a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
27 CoreFoundation 0x3088383f __CFRunLoopDoSource1 + 166
28 CoreFoundation 0x3088460d __CFRunLoopRun + 520
29 CoreFoundation 0x30814ec3 CFRunLoopRunSpecific + 230
30 CoreFoundation 0x30814dcb CFRunLoopRunInMode + 58
31 UIKit 0x35dacd49 -[UIApplication _run] + 372
32 UIKit 0x35daa807 UIApplicationMain + 670
33 ShowroomLocator 0x0000278b main + 70
34 ShowroomLocator 0x00002740 start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.2 (8H7)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
(gdb)
After adding SearchDisplayController with _tableview1 my application started crashing.
I have two tableview in same controller class. Pleas suggest something to handle this...
Edited with multiple tableview coding:
- (void)viewDidLoad {
appDelegate = (ShowroomLocatorAppDelegate *)[[UIApplication sharedApplication] delegate];
NSArray *items = [[NSArray alloc] initWithObjects:
#"Sydney Airport (SYD), Mascot NSW 2020, Australia",
#"Sydney NSW, Australia'",
#"Smithfield NSW 2164, Australia",
#"Smithfield SA 5114, Australia",
#"Smithfield QLD 4878, Australia",
nil];
self.allItems = items;
[items release];
self._tableView1.scrollEnabled = YES;
_tableView1.hidden = YES;
_tableView.hidden = YES;
[self._tableView reloadData];
self._tableView.rowHeight = 80.0;
[ self.view addSubview:_tableView] ;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView1.delegate = self;
_tableView1.dataSource = self;
}
- (void)viewWillAppear:(BOOL)animated
{
[self._tableView reloadData];
[self._tableView1 reloadData]; }
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
if(tableView ==_tableView && tableView ==_tableView1 )
{
return 1;
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if(tableView ==_tableView )
{
if(section == 0)
return [NSString stringWithFormat:NSLocalizedString(#"ShowRooms[%d]", #"Showroom format"), [appDelegate.markers count]];
}
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableview numberOfRowsInSection:(NSInteger)section {
if(tableview ==_tableView )
{
return [appDelegate.markers count];
}
if(tableview ==_tableView1 )
{ NSInteger rows = 0;
if ([_tableView1
isEqual:self.searchDisplayController.searchResultsTableView]){
rows = [self.searchResults count];
}
else{
rows = [self.allItems count];
}
return rows;
}
}
In my _tableview web-service data get fill and _tableview1 array data with address get fill.....
The above error is coming on adding _tableview1.....
I suspect, in viewWillAppear, you did a reloadData specifying self rather than self.tableView.
Related
I am trying to implement a tab bar controller, navigation controller and tableview into an application I'm working on but I am getting a SIGABRT error each time I try to run it and I don't know why and it is rather puzzling me. Below is the code that the console is referencing to (I believe):
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
NSString *cellValue = [listOfCoffees objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
return cell;
}
...and below is the console:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString tableView:cellForRowAtIndexPath:]: unrecognized selector sent to instance 0x6a17c00'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dca5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f1e313 objc_exception_throw + 44
2 CoreFoundation 0x00dcc0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d3b966 ___forwarding___ + 966
4 CoreFoundation 0x00d3b522 _CF_forwarding_prep_0 + 50
5 UIKit 0x00091b98 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634
6 UIKit 0x000874cc -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
7 UIKit 0x0009c8cc -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
8 UIKit 0x0009490c -[UITableView layoutSubviews] + 242
9 QuartzCore 0x016b4a5a -[CALayer layoutSublayers] + 181
10 QuartzCore 0x016b6ddc CALayerLayoutIfNeeded + 220
11 QuartzCore 0x0165c0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
12 QuartzCore 0x0165d294 _ZN2CA11Transaction6commitEv + 292
13 QuartzCore 0x0165d46d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
14 CoreFoundation 0x00dab89b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
15 CoreFoundation 0x00d406e7 __CFRunLoopDoObservers + 295
16 CoreFoundation 0x00d091d7 __CFRunLoopRun + 1575
17 CoreFoundation 0x00d08840 CFRunLoopRunSpecific + 208
18 CoreFoundation 0x00d08761 CFRunLoopRunInMode + 97
19 GraphicsServices 0x010021c4 GSEventRunModal + 217
20 GraphicsServices 0x01002289 GSEventRun + 115
21 UIKit 0x0002ac93 UIApplicationMain + 1160
22 Affogato 0x00002259 main + 121
23 Affogato 0x000021d5 start + 53
24 ??? 0x00000001 0x0 + 1
)
terminate called throwing an exception
Any help would be greatly appreciated.
I'm quite sure the actual problem is somewhere else in the code, my guess would be you are using some string variable (possibly selectedCoffee ?) in place of the tableView's delegate.
The error is in the tableview delegate/datasource. CellForRowAtIndexPath is called by the tableview to query it's UITableViewCell object. Check your delegate/datasource connection.
Set a breakpoint and look where the app crash. Then we could help more.
I have a TTSplitViewController in which I am trying to show a UITabBarController at the left pane, via the code:
#implementation SplitAppController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
[self setupURLRouting];
}
return self;
}
- (void)setupURLRouting {
[self routePrimaryNavigator];
[self routeDetailsNavigator];
}
- (void)routePrimaryNavigator {
TTURLMap* map = self.primaryNavigator.URLMap;
// Forward all unhandled URL actions to the right navigator.
[map from: #"*" toObject: self selector: #selector(willOpenUrlPath:)];
[map from:#"tt://primary" toViewController:[RootViewController class]];
}
RootViewController here is a UITabBarController. However, I am getting the following error:
2011-07-08 08:04:23.739 app[3241:207] -[RootViewController topViewController]: unrecognized selector sent to instance 0x520c060
2011-07-08 08:04:23.755 app[3241:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RootViewController topViewController]: unrecognized selector sent to instance 0x520c060'
*** Call stack at first throw:
(
0 CoreFoundation 0x017d95a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0192d313 objc_exception_throw + 44
2 CoreFoundation 0x017db0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0174a966 ___forwarding___ + 966
4 CoreFoundation 0x0174a522 _CF_forwarding_prep_0 + 50
5 app 0x000f73ff -[TTSplitViewController updateSplitViewButton] + 176
6 app 0x000f75d9 -[TTSplitViewController viewDidAppear:] + 90
7 UIKit 0x00ae1fab -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 694
8 UIKit 0x00a64e4b -[UIView(Internal) _didMoveFromWindow:toWindow:] + 918
9 UIKit 0x00a63a60 -[UIView(Hierarchy) _postMovedFromSuperview:] + 166
10 UIKit 0x00a5c750 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1080
11 UIKit 0x00a5aaa3 -[UIView(Hierarchy) addSubview:] + 57
12 app 0x00083d01 -[TTBaseNavigator setRootViewController:] + 306
13 app 0x000841f9 -[TTBaseNavigator presentController:parentController:mode:action:] + 70
14 app 0x00084437 -[TTBaseNavigator presentController:parentURLPath:withPattern:action:] + 359
15 app 0x00084975 -[TTBaseNavigator openURLAction:] + 1320
16 app 0x0000c440 -[appAppDelegate application:didFinishLaunchingWithOptions:] + 848
17 UIKit 0x00a2bc89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
18 UIKit 0x00a2dd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
19 UIKit 0x00a38617 -[UIApplication handleEvent:withNewEvent:] + 1533
20 UIKit 0x00a30abf -[UIApplication sendEvent:] + 71
21 UIKit 0x00a35f2e _UIApplicationHandleEvent + 7576
22 GraphicsServices 0x01fee992 PurpleEventCallback + 1550
23 CoreFoundation 0x017ba944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
24 CoreFoundation 0x0171acf7 __CFRunLoopDoSource1 + 215
25 CoreFoundation 0x01717f83 __CFRunLoopRun + 979
26 CoreFoundation 0x01717840 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x01717761 CFRunLoopRunInMode + 97
28 UIKit 0x00a2d7d2 -[UIApplication _run] + 623
29 UIKit 0x00a39c93 UIApplicationMain + 1160
30 app 0x00031342 main + 130
31 app 0x00002a75 start + 53
)
terminate called after throwing an instance of 'NSException'
How do I fix this?
Seems like your code is expecting RootViewController to be a subclass of UINavigationController.
If you didn't write that code, you can make a UINavigationController subclass, and initialize it with your tab bar controller as a root view controller, and hide the navigation bar, I think this would give the results you are looking for.
EmilioPelaez is quite right, I just succeeded with a similar solution like this, and it works!
#implementation MainViewController
- (id)initWithNavigatorURL:(NSURL *)URL query:(NSDictionary *)query {
MainTabBarController *mainTabBarController = [[MainTabBarController alloc] init];
[mainTabBarController setTabURLs:[NSArray arrayWithObjects:
#"tt://firstLink",
#"tt://secondLink",
nil]];
self = [super initWithRootViewController:mainTabBarController];
[mainTabBarController release];
self.navigationBarHidden = YES;
return self;
}
#end
I found another way to make it work (and maybe the better way that reduce code complexity):
inherit UITabBarController with this additional method:
- (UIViewController *)topViewController {
return self;
}
It works perfectly.
is this right
[map from:#"tt://primary" toViewController:[RootViewController class]];
my suggestion is
[map from:#"tt://primary" toViewController:RootViewControllerobject];
Here is the code:
- (IBAction)textFieldDidBeginEditing:(UITextField *)textField
{
NSLog(#"Inside textfieldDidBeginEditing");
textFieldBeingEdited = textField;
}
//==============================================================================
-(IBAction)textFieldDoneEditing:(id)sender
{
textFieldBeingEdited = NULL;
[sender resignFirstResponder];
if (moveViewUp)
{
[self scrollTheView:NO];
}
}
//==============================================================================
-(void)keyboardWillShow:(NSNotification *)notif
{
NSLog(#"Inside keyborad will show");
NSDictionary *info = [notif userInfo];
NSValue *aValue = [info objectForKey:UIKeyboardFrameBeginUserInfoKey];
CGSize keyboardSize = [aValue CGRectValue].size;
float bottomPoint = (textFieldBeingEdited.frame.origin.y + textFieldBeingEdited.frame.size.height /*+ 20*/);
scrollAmount = keyboardSize.height - (self.view.frame.size.height- bottomPoint);
if(scrollAmount > 0)
{
moveViewUp = YES;
[self scrollTheView:YES];
}
else
{
moveViewUp = NO;
}
}
Here is the screen shot of the view controller
when I tap on any one of these text fields. An exception is thrown
-[__NSCFType textFieldDidBeginEditing:]: unrecognized selector sent to instance 0x5a3c100
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType textFieldDidBeginEditing:]: unrecognized selector sent to instance 0x5a3c100'
*** Call stack at first throw:
(
0 CoreFoundation 0x010275a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0117b313 objc_exception_throw + 44
2 CoreFoundation 0x010290bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00f98966 ___forwarding___ + 966
4 CoreFoundation 0x00f98522 _CF_forwarding_prep_0 + 50
5 UIKit 0x003a1581 -[UIControl(Deprecated) sendAction:toTarget:forEvent:] + 67
6 UIKit 0x003a3e62 -[UIControl(Internal) _sendActionsForEventMask:withEvent:] + 525
7 UIKit 0x003a9e11 -[UITextField willAttachFieldEditor:] + 404
8 UIKit 0x003bbcdf -[UIFieldEditor becomeFieldEditorForView:] + 653
9 UIKit 0x003abf98 -[UITextField _becomeFirstResponder] + 99
10 UIKit 0x003e02c3 -[UIResponder becomeFirstResponder] + 328
11 UIKit 0x005a8961 -[UITextInteractionAssistant setFirstResponderIfNecessary] + 208
12 UIKit 0x005ab5e2 -[UITextInteractionAssistant oneFingerTap:] + 1676
13 UIKit 0x005a24f2 -[UIGestureRecognizer _updateGestureWithEvent:] + 730
14 UIKit 0x0059e4fe -[UIGestureRecognizer _delayedUpdateGesture] + 47
15 UIKit 0x005a4afc _UIGestureRecognizerUpdateObserver + 584
16 UIKit 0x005a4ce1 _UIGestureRecognizerUpdateGesturesFromSendEvent + 51
17 UIKit 0x0033832a -[UIWindow _sendGesturesForEvent:] + 1292
18 UIKit 0x00333ca3 -[UIWindow sendEvent:] + 105
19 UIKit 0x00316c37 -[UIApplication sendEvent:] + 447
20 UIKit 0x0031bf2e _UIApplicationHandleEvent + 7576
21 GraphicsServices 0x0197f992 PurpleEventCallback + 1550
22 CoreFoundation 0x01008944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
23 CoreFoundation 0x00f68cf7 __CFRunLoopDoSource1 + 215
24 CoreFoundation 0x00f65f83 __CFRunLoopRun + 979
25 CoreFoundation 0x00f65840 CFRunLoopRunSpecific + 208
26 CoreFoundation 0x00f65761 CFRunLoopRunInMode + 97
27 GraphicsServices 0x0197e1c4 GSEventRunModal + 217
28 GraphicsServices 0x0197e289 GSEventRun + 115
29 UIKit 0x0031fc93 UIApplicationMain + 1160
terminate called after throwing an instance of 'NSException'
please help
Shouldn't the method signature be:
-(void)textFieldDidBeginEditing:(UITextField *)textField
i.e. (void) instead of (IBAction)
So, I'm debugging an app I'm building and using the description method to help me find the problem. But instead of giving me the app as a string it is printing out parentheses instead. Please help!
Here's the code:
- (void)viewDidLoad {
[super viewDidLoad];
reminders = [[NSMutableArray alloc] init];
currentTitle = [[NSMutableString alloc] init];
currentDate = [[NSMutableString alloc] init];
currentSummary = [[
NSMutableString alloc] init];
currentLink = [[NSMutableString alloc] init];
NSLog(#"IT'S HERE %#", [reminders description]);}
...
and the error:
[Session started at 2010-10-04 22:15:16 -0400.]
2010-10-04 22:15:17.434 Reminders[5824:207] ******* Accessibility Status Changed: On
2010-10-04 22:15:17.464 Reminders[5824:207] ********** Loading AX for: com.yourcompany.Reminders ************
2010-10-04 22:15:17.506 Reminders[5824:207] IT'S HERE (
)
2010-10-04 22:15:17.510 Reminders[5824:207] Hello
2010-10-04 22:15:17.512 Reminders[5824:207] (
)
2010-10-04 22:15:17.514 Reminders[5824:207] PVC: <UITableView: 0x602d600; frame = (0 20; 320 460); clipsToBounds = YES; opaque = NO; autoresize = W+H; layer = <CALayer: 0x5f3f3b0>; contentOffset: {0, 0}>
2010-10-04 22:15:17.514 Reminders[5824:207] It's here
2010-10-04 22:15:17.515 Reminders[5824:207] Loaded
2010-10-04 22:15:17.520 Reminders[5824:207] -[__NSCFArray name]: unrecognized selector sent to instance 0x6a4b640
2010-10-04 22:15:17.523 Reminders[5824:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFArray name]: unrecognized selector sent to instance 0x6a4b640'
*** Call stack at first throw:
(
0 CoreFoundation 0x0248bb99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x025db40e objc_exception_throw + 47
2 CoreFoundation 0x0248d6ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x023fd2b6 ___forwarding___ + 966
4 CoreFoundation 0x023fce72 _CF_forwarding_prep_0 + 50
5 Reminders 0x00003aa9 -[RootViewController tableView:cellForRowAtIndexPath:] + 300
6 UIKit 0x00090d6f -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 619
7 UIKit 0x00086e02 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
8 UIKit 0x0009b774 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
9 UIKit 0x000937ec -[UITableView layoutSubviews] + 242
10 QuartzCore 0x03f60481 -[CALayer layoutSublayers] + 177
11 QuartzCore 0x03f601b1 CALayerLayoutIfNeeded + 220
12 QuartzCore 0x03f592e0 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 302
13 QuartzCore 0x03f59040 _ZN2CA11Transaction6commitEv + 292
14 UIKit 0x0002204e -[UIApplication _reportAppLaunchFinished] + 39
15 UIKit 0x00022477 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 545
16 UIKit 0x0002c3ec -[UIApplication handleEvent:withNewEvent:] + 1958
17 UIKit 0x00024b3c -[UIApplication sendEvent:] + 71
18 UIKit 0x000299bf _UIApplicationHandleEvent + 7672
19 GraphicsServices 0x026fa822 PurpleEventCallback + 1550
20 CoreFoundation 0x0246cff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
21 CoreFoundation 0x023cd807 __CFRunLoopDoSource1 + 215
22 CoreFoundation 0x023caa93 __CFRunLoopRun + 979
23 CoreFoundation 0x023ca350 CFRunLoopRunSpecific + 208
24 CoreFoundation 0x023ca271 CFRunLoopRunInMode + 97
25 UIKit 0x00021c6d -[UIApplication _run] + 625
26 UIKit 0x0002daf2 UIApplicationMain + 1160
27 Reminders 0x00002078 main + 102
28 Reminders 0x00002009 start + 53
)
terminate called after throwing an instance of 'NSException'
Here's the method that you asked for fluchtpunkt
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
Reminder *theReminder = [reminders objectAtIndex:indexPath.row];
cell.textLabel.text = theReminder.name;
return cell;
}
those parentheses are the output I would expect if I NSLog an empty array.
This is absolutely correct.
the exception is raised because you try to call a name method on an NS(Mutable)Array. And arrays don't respond to name.
To find the cause of this Exception post the code of this method in your RootViewController
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
My app crashes - unfortunately, it's not reproducable - this is a crash log I got, but I cannot read anything that would help me. Perhaps someone of you? Would be reeeeeeeeally great...
0 libSystem.B.dylib 0x00088c24 __kill + 8
1 libSystem.B.dylib 0x00088c12 kill + 4
2 libSystem.B.dylib 0x00088c06 raise + 10
3 libSystem.B.dylib 0x0009f902 abort + 54
4 libstdc++.6.dylib 0x00065a00 __gnu_cxx::__verbose_terminate_handler() + 588
5 libobjc.A.dylib 0x00007f1c _objc_terminate + 160
6 libstdc++.6.dylib 0x00063100 __cxxabiv1::__terminate(void (*)()) + 76
7 libstdc++.6.dylib 0x00063178 std::terminate() + 16
8 libstdc++.6.dylib 0x000632a0 __cxa_throw + 100
9 libobjc.A.dylib 0x00006504 objc_exception_throw + 104
10 CoreFoundation 0x000a01c0 +[NSException raise:format:arguments:] + 64
11 CoreFoundation 0x000a01f4 +[NSException raise:format:] + 24
12 Foundation 0x0002cbc6 -[NSPlaceholderMutableString initWithString:] + 78
13 here_my_app 0x0002c35e 0x1000 + 176990
14 here_my_app 0x00029a6c 0x1000 + 166508
15 UIKit 0x000a9248 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 644
16 UIKit 0x000a8eac -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 44
17 UIKit 0x0006f3b8 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1100
18 UIKit 0x0006ce40 -[UITableView layoutSubviews] + 200
19 UIKit 0x00014ab0 -[UIView(CALayerDelegate) _layoutSublayersOfLayer:] + 32
20 CoreFoundation 0x000285ba -[NSObject(NSObject) performSelector:withObject:] + 18
21 QuartzCore 0x0000a61c -[CALayer layoutSublayers] + 176
22 QuartzCore 0x0000a2a4 CALayerLayoutIfNeeded + 192
23 QuartzCore 0x00009bb0 CA::Context::commit_transaction(CA::Transaction*) + 256
24 QuartzCore 0x000097d8 CA::Transaction::commit() + 276
25 QuartzCore 0x000119d8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
26 CoreFoundation 0x00074244 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
27 CoreFoundation 0x00075d9e __CFRunLoopDoObservers + 494
28 CoreFoundation 0x000772f6 __CFRunLoopRun + 934
29 CoreFoundation 0x0001e0bc CFRunLoopRunSpecific + 220
30 CoreFoundation 0x0001dfca CFRunLoopRunInMode + 54
31 GraphicsServices 0x00003f88 GSEventRunModal + 188
32 UIKit 0x00007b40 -[UIApplication _run] + 564
33 UIKit 0x00005fb8 UIApplicationMain + 964
34 here_my_app 0x00002f52 0x1000 + 8018
35 here_my_app 0x00002efc 0x1000 + 7932
here's the code for my "cellForRowAtIndexPath"
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"AbfahrtszeitResultTableCell";
AbfahrtszeitResultTableCell *cell = (AbfahrtszeitResultTableCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:#"AbfahrtszeitResultTableCell" owner:nil options:nil];
for (id currentObject in topLevelObjects) {
if ([currentObject isKindOfClass:[UITableViewCell class]]) {
cell = (AbfahrtszeitResultTableCell *) currentObject;
break;
}
}
// make cell not-selectable
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// background color
BOOL day = [self isDayView];
if (day) {
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:ABFAHRTSZEIT_RESULT_TABLE_CELL_BACKGROUND_IMAGE_RED]];
cell.backgroundView = imageView;
[imageView release];
} else {
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:ABFAHRTSZEIT_RESULT_TABLE_CELL_BACKGROUND_IMAGE_BLUE]];
cell.backgroundView = imageView;
[imageView release];
}
// text color
cell.textLabel.textColor = [UIColor whiteColor];
}
// Set up the cell...
AbfahrtszeitResult *result = [abfahrten objectAtIndex:indexPath.row];
cell.linienLabel.text = [TextUtil cleanUpString:result.linie];
cell.zielLabel.text = [TextUtil cleanUpString:result.ziel];
cell.zeitLabel.text = [TextUtil cleanUpString:result.zeit];
return cell;
}
You read the stack from the bottom to the top. Here's the key area:
12 Foundation 0x0002cbc6 -[NSPlaceholderMutableString initWithString:] + 78
13 here_my_app 0x0002c35e 0x1000 + 176990
14 here_my_app 0x00029a6c 0x1000 + 166508
15 UIKit 0x000a9248 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 644
It looks like 15 is UIKit trying to create cells for a UITableView. 13 and 14 are in your code, likely your tableView:cellForRowAtIndexPath: method. 12 is a Foundation method dealing with strings.
I would take a look at your tableView:cellForRowAtIndexPath: method and see what you could be doing wrong with string initialization or post your method for us to examine.
Not enough information. You're stuck. Better not strip the symbols next time :)
Anyway, the key lines are
12 Foundation 0x0002cbc6 -[NSPlaceholderMutableString initWithString:] + 78
13 here_my_app 0x0002c35e 0x1000 + 176990
14 here_my_app 0x00029a6c 0x1000 + 166508
15 UIKit 0x000a9248 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 644
From #15 we know the error is in the -tableView:cellForRowAtIndexPath: method in one of your delegates, and from #12 we know the error is due to initializing a string. The only way -initWithString: will throw is when the input argument is nil. Check the custom function called from -tableView:cellForRowAtIndexPath: and ensure the string is not nil.