Problems merging two tableviews into a tabbar with Core Data - iphone

I have one tabbar with several views, one with a tableview connected to Core Data. Now I've made one more tableview in a different project, and I want to merge it to my first project. This isn't new to me, I've done it before in another project where I had three tableviews with different core data tables, all working good. So I thought this would be a walk in the park.
In my AppDelage.m and .h I've added and copied all the code for the managedObjectContext to managedObjectContext2. And made a new navigation controller, "navigationController2".
ProtokollList *protokollList = (ProtokollList *)[navigationController2 topViewController];
// Set its managedObjectContext property to the managed object context
protokollList.managedObjectContext2 = self.managedObjectContext2;
// Get the root view controller; it's in the topViewController property of the navigation controller
KortKategori *kortKategori = (KortKategori *)[navigationController topViewController];
// Set its managedObjectContext property to the managed object context
kortKategori.managedObjectContext = self.managedObjectContext;
And then in my ProtokollList.m I've changed managedObjectContext to managedObjectContext2. And made necessary connections in MainWindow.nib.
But when I try to run the project I get this error message:
2011-07-24 18:22:58.188 Kortspel[1346:207] Unknown class ProtokollList in Interface Builder file.
2011-07-24 18:22:58.198 Kortspel[1346:207] -[UIViewController setManagedObjectContext2:]: unrecognized selector sent to instance 0x4d13c40
2011-07-24 18:22:58.199 Kortspel[1346:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setManagedObjectContext2:]: unrecognized selector sent to instance 0x4d13c40'
*** Call stack at first throw:
(
0 CoreFoundation 0x00fab5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x010ff313 objc_exception_throw + 44
2 CoreFoundation 0x00fad0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00f1c966 ___forwarding___ + 966
4 CoreFoundation 0x00f1c522 _CF_forwarding_prep_0 + 50
5 Kortspel 0x00001f28 -[KortAppDelegate applicationDidFinishLaunching:] + 709
6 UIKit 0x002c4ce2 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1252
7 UIKit 0x002c6d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
8 UIKit 0x002d1617 -[UIApplication handleEvent:withNewEvent:] + 1533
9 UIKit 0x002c9abf -[UIApplication sendEvent:] + 71
10 UIKit 0x002cef2e _UIApplicationHandleEvent + 7576
11 GraphicsServices 0x01903992 PurpleEventCallback + 1550
12 CoreFoundation 0x00f8c944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
13 CoreFoundation 0x00eeccf7 __CFRunLoopDoSource1 + 215
14 CoreFoundation 0x00ee9f83 __CFRunLoopRun + 979
15 CoreFoundation 0x00ee9840 CFRunLoopRunSpecific + 208
16 CoreFoundation 0x00ee9761 CFRunLoopRunInMode + 97
17 UIKit 0x002c67d2 -[UIApplication _run] + 623
18 UIKit 0x002d2c93 UIApplicationMain + 1160
19 Kortspel 0x00001c40 main + 102
20 Kortspel 0x00001bd1 start + 53
)
terminate called after throwing an instance of 'NSException'
I don't know it says that it doesn't recognize "ProtokollList" class, because it's defined in ProtokollList.h.
Does anyone have any idea? This is the last step before launching!
EDIT:
If I try to blank out:
/*
ProtokollList *protokollList = (ProtokollList *)[navigationController2 topViewController];
// Set its managedObjectContext property to the managed object context
protokollList.managedObjectContext2 = self.managedObjectContext2;
*/
I can open the project, but when I click on ProtokollList-tableview I get this new error message:
2011-07-25 20:06:56.588 Kortspel[3205:207] Unknown class ProtokollList in Interface Builder file.
2011-07-25 20:07:01.585 Kortspel[3205:207] -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x590f3f0
2011-07-25 20:07:01.587 Kortspel[3205:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x590f3f0'
*** Call stack at first throw:
(
0 CoreFoundation 0x00fb25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01106313 objc_exception_throw + 44
2 CoreFoundation 0x00fb40bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00f23966 ___forwarding___ + 966
4 CoreFoundation 0x00f23522 _CF_forwarding_prep_0 + 50
5 UIKit 0x004882b7 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 1834
6 UIKit 0x00485d88 -[UITableViewRowData numberOfRows] + 108
7 UIKit 0x00339677 -[UITableView noteNumberOfRowsChanged] + 132
8 UIKit 0x00346708 -[UITableView reloadData] + 773
9 UIKit 0x00343844 -[UITableView layoutSubviews] + 42
10 QuartzCore 0x01f52a5a -[CALayer layoutSublayers] + 181
11 QuartzCore 0x01f54ddc CALayerLayoutIfNeeded + 220
12 QuartzCore 0x01efa0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
13 QuartzCore 0x01efb294 _ZN2CA11Transaction6commitEv + 292
14 QuartzCore 0x01efb46d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
15 CoreFoundation 0x00f9389b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
16 CoreFoundation 0x00f286e7 __CFRunLoopDoObservers + 295
17 CoreFoundation 0x00ef11d7 __CFRunLoopRun + 1575
18 CoreFoundation 0x00ef0840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00ef0761 CFRunLoopRunInMode + 97
20 GraphicsServices 0x019091c4 GSEventRunModal + 217
21 GraphicsServices 0x01909289 GSEventRun + 115
22 UIKit 0x002d9c93 UIApplicationMain + 1160
23 Kortspel 0x00002524 main + 102
24 Kortspel 0x000024b5 start + 53
)
terminate called after throwing an instance of 'NSException'
Best regards,
xqtr

EDIT:
I understand that the critical point is the warning about IB (did not notice it at start)...
Could you check that ProtokollList.h and ProtokollList.m are effectively assigned to the target you are building? (I think so, otherwise you would have more linking problems, anyway, this is a basic check).
If this is ok, then I would simply try a clean and rebuild all.
If this does not fix the problem, then this might mean that the linker is not including ProtokollList.m in the final binary because of some optimization (the class is possibly never referenced in the rest of your code, just in Interface Builder). The fix for this is adding -all_load to the linker flags of your project.
If this does not help, I am very sad but I have no more suggestions...
You are calling:
protokollList.managedObjectContext2 = self.managedObjectContext2;
and no property named managedObjectContext2 is found in protokollList. This can be inferred by the line:
-[UIViewController setManagedObjectContext2:]: unrecognized selector sent to instance 0x4d13c40
So, you should possilby define managedObjectContext2 in protokollList (which should be a UIViewController).
EDIT;
interface ProtokollList : UITableViewController <NSFetchedResultsControllerDelegate> {
NSFetchedResultsController *fetchedResultsController2;
NSManagedObjectContext *managedObjectContext2;
}
#property (nonatomic, retain) NSManagedObjectContext *managedObjectContext2;
#end

Related

tableView in xib not picking up datasource delegate methods in associated view controller

My main xib file has a tab bar controller and each tab is linked to a different xib.
One of the tabs is a nav controller and its view controller is linked to a xib as per this answer.
When I run the app I get the below error. its as if its not even looking in the view controller for these methods.
i have tried everything including using a different xib, checking the links in interface builder i.e. the tableview's delegate and datasource. i have implemented the required protocol methods in the vc e.g. numberofrowsinsection.
as soon as i remove the datasource link in the xib the error goes away.
EDIT: When I add this view controller's view to the main window (just to test) the tableview loads without issues. So it seems it only happens when I use it as part of the nav controller and tab controller.
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[UIViewController
tableView:numberOfRowsInSection:]: unrecognized selector sent to
instance 0x6120ae0'
* Call stack at first throw: ( 0 CoreFoundation
0x00dc45a9 exceptionPreprocess + 185 1 libobjc.A.dylib
0x00f18313 objc_exception_throw + 44 2 CoreFoundation
0x00dc60bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3
CoreFoundation 0x00d35966 __forwarding + 966
4 CoreFoundation 0x00d35522
_CF_forwarding_prep_0 + 50 5 UIKit
0x001d32b7 -[UISectionRowData
refreshWithSection:tableView:tableViewRowData:] + 1834 6 UIKit
0x001d0d88 -[UITableViewRowData numberOfRows] + 108 7 UIKit
0x00084677 -[UITableView noteNumberOfRowsChanged] + 132 8 UIKit
0x00091708 -[UITableView reloadData] + 773 9 UIKit
0x0008e844 -[UITableView layoutSubviews] + 42 10 QuartzCore
0x016aea5a -[CALayer layoutSublayers] + 181 11 QuartzCore
0x016b0ddc CALayerLayoutIfNeeded + 220 12 QuartzCore
0x016560b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
13 QuartzCore 0x01657294
_ZN2CA11Transaction6commitEv + 292 14 QuartzCore
0x0165746d
_ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
15 CoreFoundation 0x00da589b
CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 27 16
CoreFoundation 0x00d3a6e7 __CFRunLoopDoObservers
+ 295 17 CoreFoundation 0x00d031d7
__CFRunLoopRun + 1575 18 CoreFoundation
0x00d02840 CFRunLoopRunSpecific + 208 19 CoreFoundation
0x00d02761 CFRunLoopRunInMode + 97 20 GraphicsServices
0x00ffc1c4 GSEventRunModal + 217 21 GraphicsServices
0x00ffc289 GSEventRun + 115 22 UIKit
0x00024c93 UIApplicationMain + 1160 23 MyPractice
0x00002339 main + 121 24 MyPractice
0x000022b5 start + 53 ) terminate called after throwing an instance of
'NSException'
This log message:
[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance
Implies that the UITableView dataSource method is being sent to an instance of UIViewController, not an instance of your subclass. How are you initialising your VC? If you're initialising it from within a XIB, have you correctly set the VC's class to your subclass?

Error in dismissing a modal view controller

I have encountered application termination while dismissing a modal view controller.
-[NSCFString window]: unrecognized selector sent to instance 0x6337dc0
2011-06-03 13:26:37.980 Tuscany[19657:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString window]: unrecognized selector sent to instance 0x6337dc0'
*** Call stack at first throw:
(
0 CoreFoundation 0x016ffbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x018545c2 objc_exception_throw + 47
2 CoreFoundation 0x017016fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01671366 ___forwarding___ + 966
4 CoreFoundation 0x01670f22 _CF_forwarding_prep_0 + 50
5 UIKit 0x003f4024 -[UIViewController viewControllerForRotation] + 81
6 UIKit 0x003ee8ab -[UIViewController shouldWindowUseOnePartInterfaceRotationAnimation:] + 34
7 UIKit 0x00368dd5 -[UIWindow _clientsForRotation] + 350
8 UIKit 0x0036b87b -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 141
9 UIKit 0x005eb948 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1053
10 UIKit 0x003f7682 -[UIViewController _dismissModalViewControllerWithTransition:from:] + 2075
11 UIKit 0x003f4324 -[UIViewController dismissModalViewControllerWithTransition:] + 579
12 Foundation 0x000c37f6 __NSFireDelayedPerform + 441
13 CoreFoundation 0x016e0fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
14 CoreFoundation 0x016e2594 __CFRunLoopDoTimer + 1220
15 CoreFoundation 0x0163ecc9 __CFRunLoopRun + 1817
16 CoreFoundation 0x0163e240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x0163e161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x01d88268 GSEventRunModal + 217
19 GraphicsServices 0x01d8832d GSEventRun + 115
20 UIKit 0x0035342e UIApplicationMain + 1160
21 Tuscany 0x00002878 main + 102
22 Tuscany 0x00002809 start + 53
)
terminate called after throwing an instance of 'NSException'
Above is the crash log. Please help.
Thanks in advance.
From you log it seems that you are calling window on an NSCFString. NSCFString does not have a window selector, and the compiler would complain if you try and do so, so it is likely that you are sending that message to a deallocated object (imagine that a new object has been allocated where another one was previously), or you are messing with casts.
In case you suspect that you are sending the message to a deallocated object, enable NSZombies.
Without seeing the code, it is not possible to help you further, though.

unrecognized selector sent to instance

I have added a tabbarcontroller on window and a button on view respective to first tab.
As I run the app and press the button, the app is crashing with this msg:
2011-05-20 18:56:46.258 FeatureList[3395:207] -[UIViewController barButtonPressed:]: unrecognized selector sent to instance 0x4b22520
2011-05-20 18:56:46.262 FeatureList[3395:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController barButtonPressed:]: unrecognized selector sent to instance 0x4b22520'
*** Call stack at first throw:
(
0 CoreFoundation 0x00da9be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00efe5c2 objc_exception_throw + 47
2 CoreFoundation 0x00dab6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d1b366 ___forwarding___ + 966
4 CoreFoundation 0x00d1af22 _CF_forwarding_prep_0 + 50
5 UIKit 0x002b2a6e -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x003411b5 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x00343647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x003421f4 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x002d70d1 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x002b837a -[UIApplication sendEvent:] + 447
11 UIKit 0x002bd732 _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x016dfa36 PurpleEventCallback + 1550
13 CoreFoundation 0x00d8b064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00ceb6f7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00ce8983 __CFRunLoopRun + 979
16 CoreFoundation 0x00ce8240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00ce8161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x016de268 GSEventRunModal + 217
19 GraphicsServices 0x016de32d GSEventRun + 115
20 UIKit 0x002c142e UIApplicationMain + 1160
21 FeatureList 0x000024fc main + 102
22 FeatureList 0x0000248d start + 53
23 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
kill
quit
The Debugger has exited with status 0.(gdb)
This happens when you try to call a method that doesn't exist. It looks like you've set up your button to send a message to the view controller (barButtonPressed:), but you may not have implemented the method if your view controller. Or you may have misspelled the method name or not included the argument in the method implementation.
Post your view controller code.
It looks like the button is trying to call barButtonPressed: on the view controller, but that method doesn't exist. Are you sure you don't get warnings during compilation regarding missing methods? My guess is you're not setting the view controller class correctly in a nib file.
Have you implemented barButtonPressed:? Are you sure you need the colon? Try barButtonPressed as the selector name instead.
This is an old question, but I think I know what happened. Notice how the error message says UIViewController instead of TodayDeal; he needed to change the Xib's file owner from a default UIViewController to TodayDeal

Unrecognized Selector with OHGridView

I downloaded the OHGridView hoping that it was the answer to all my problems.
https://github.com/AliSoftware/OHGridView
I did all that it said to do (add the class files, add the code, and change a few other things).
I went to build it and it crashed. I realized the lines of code why it was crashing:
((OHGridView *)self.view).rowHeight = 100;
((OHGridView *)self.view).columnsCount = 2;
Error from Console:
`-[UIView setRowHeight:]: unrecognized selector sent to instance 0x4b55110
2011-02-20 09:01:16.906 TableView[14358:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setRowHeight:]: unrecognized selector sent to instance 0x4b55110'
*** Call stack at first throw:
(
0 CoreFoundation 0x00e4dbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00fa25c2 objc_exception_throw + 47
2 CoreFoundation 0x00e4f6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00dbf366 ___forwarding___ + 966
4 CoreFoundation 0x00dbef22 _CF_forwarding_prep_0 + 50
5 TableView 0x00004232 -[DetailViewController viewDidLoad] + 831
6 UIKit 0x0037165e -[UIViewController view] + 179
7 UIKit 0x0036fa57 -[UIViewController contentScrollView] + 42
8 UIKit 0x00380201 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
9 UIKit 0x0037e831 -[UINavigationController _layoutViewController:] + 43
10 UIKit 0x0037fa86 -[UINavigationController _startTransition:fromViewController:toViewController:] + 326
11 UIKit 0x0037a606 -[UINavigationController _startDeferredTransitionIfNeeded] + 266
12 UIKit 0x0038183e -[UINavigationController pushViewController:transition:forceImmediate:] + 932
13 UIKit 0x0037a4a0 -[UINavigationController pushViewController:animated:] + 62
14 TableView 0x00002e4f -[RootViewController tableView:didSelectRowAtIndexPath:] + 681
15 UIKit 0x00339794 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
16 UIKit 0x0032fd50 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
17 Foundation 0x000427f6 __NSFireDelayedPerform + 441
18 CoreFoundation 0x00e2efe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
19 CoreFoundation 0x00e30594 __CFRunLoopDoTimer + 1220
20 CoreFoundation 0x00d8ccc9 __CFRunLoopRun + 1817
21 CoreFoundation 0x00d8c240 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x00d8c161 CFRunLoopRunInMode + 97
23 GraphicsServices 0x016ef268 GSEventRunModal + 217
24 GraphicsServices 0x016ef32d GSEventRun + 115
25 UIKit 0x002d242e UIApplicationMain + 1160
26 TableView 0x00001abc main + 102
27 TableView 0x00001a4d start + 53
)
terminate called after throwing an instance of 'NSException`
I removed them and it loaded fine but I didn't see any content.
Please help,
thanks.
I did a clone of the repository just now and then did a build and run of his example project without making any changes to the code. It ran without any warnings or errors.
You'll need to check your code wherever you made changes.
update after your comment
Unrecognized Selector often means that you have a capitalization error or that your code isn't the kind of object that you think it is.
For example: I can get almost the same error that you get if I try to call the setRowHeight: directly against a OHGridView object instead of the view property of the object, like this
((OHGridView*)self).rowHeight = 100;
((OHGridView*)self).columnsCount = 2;
So, I would check your code to make sure that your object is an OHGridView and that you are setting the rowHeight property of the view of the OHGridView.

What is the possible reason of "[UIWindow length]: unrecognized selector" error

My iPhone app is a Tab Bar Application, which has 5 tabs. In each tab, there is a table view, embedded with navigation controller. When these table views appear, data will be loaded from database.
When I switch the tabs very fast by tapping the tab bar randomly, the app crashes sometimes.
The error is:
+[UIWindow length]: unrecognized selector sent to class 0x3e055bd4
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIWindow length]: unrecognized selector sent to class 0x3e055bd4'
terminate called after throwing an instance of 'NSException'
Does anyone have advices or hints about find out the reason of the problem?
P.S. I created another similar but simpler app, which cannot be crashed by this way.
More info about calling stack:
> *** Call stack at first throw:
(
0 CoreFoundation 0x31785fd3 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x320118a5 objc_exception_throw + 24
2 CoreFoundation 0x31789af3 +[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x31788f15 ___forwarding___ + 508
4 CoreFoundation 0x3171b680 _CF_forwarding_prep_0 + 48
5 UIKit 0x3019a3ff -[UITableHeaderFooterView setText:] + 30
6 UIKit 0x3028239d -[UITableView(UITableViewInternal) _sectionHeaderView:withFrame:forSection:opaque:reuseViewIfPossible:] + 488
7 UIKit 0x30199e41 -[UITableView(UITableViewInternal) _sectionHeaderViewWithFrame:forSection:opaque:reuseViewIfPossible:] + 60
8 UIKit 0x3016bcb1 -[UITableView(_UITableViewPrivate) _updateVisibleHeadersAndFootersNow:] + 852
9 UIKit 0x3016b1a1 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1408
10 UIKit 0x301693c1 -[UITableView layoutSubviews] + 140
11 UIKit 0x301276ab -[UIView(CALayerDelegate) _layoutSublayersOfLayer:] + 26
12 CoreFoundation 0x317117ff -[NSObject(NSObject) performSelector:withObject:] + 22
13 QuartzCore 0x321e2585 -[CALayer layoutSublayers] + 120
14 QuartzCore 0x321e233d CALayerLayoutIfNeeded + 184
15 QuartzCore 0x321e1e0f _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 210
16 QuartzCore 0x321e1b69 _ZN2CA11Transaction6commitEv + 192
17 QuartzCore 0x321e740d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 52
18 CoreFoundation 0x3175ba49 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16
19 CoreFoundation 0x3175d475 __CFRunLoopDoObservers + 412
20 CoreFoundation 0x3175e77b __CFRunLoopRun + 854
21 CoreFoundation 0x317078eb CFRunLoopRunSpecific + 230
22 CoreFoundation 0x317077f3 CFRunLoopRunInMode + 58
23 GraphicsServices 0x33ac26ef GSEventRunModal + 114
24 GraphicsServices 0x33ac279b GSEventRun + 62
25 UIKit 0x3011e2a7 -[UIApplication _run] + 402
26 UIKit 0x3011ce17 UIApplicationMain + 670
27 MyAPP 0x00002193 main + 70
28 MyAPP 0x00002114 start + 52
)
Most likely a dangling pointer to a former NSString now occupied by a UIWindow object. You'll have to find the lost object and probably retain it.
In XCode, select "Edit Active Executable..." under the Project menu. Select the "Arguments" tab and add an entry named "NSZombieEnabled" set to "YES" to the "Variables to be set in the environment" section.
NSZombieEnabled marks deleted objects as "Zombies" rather than reclaiming their space. When enabled, an exception is thrown any time a message is sent to a Zombie object. That should help you narrow down which object is not being retained properly.
Happy Zombie Hunting!
I can only guess that you try to call +[UIWindow length] somewhere in your code. And the method length does not exist in Apple API
Eventually, I found the problem.
I init a subview in viewWillApear: and use it in tableView:viewForHeaderInSection: and release the subview in viewDidDisappear:.
I changed the init/release into viewDidLoad: and viewDidUnload:. Then the problem is gone.
Thank both answerers and hope this answer will help others.