'NSInternalInconsistencyException', reason: 'custom navigation transition - no popping between different orientations!' - ios

I'm facing a problem with UIViewController containment via MFSideMenu.
Problem is, on ViewControllers that support orientation, opening the side menu and selecting a different menu option (when the device is in landscape mode) causes the app to crash. This behavior worked perfectly in iOS 6, but is now failing in iOS 7.
Here's the stack trace:
2014-03-05 14:40:00.335 MyApp[21890:70b]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'custom navigation transition - no popping between different orientations!'
*** First throw call stack:
(
0 CoreFoundation 0x024515e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x021098b6 objc_exception_throw + 44
2 CoreFoundation 0x024513bb +[NSException raise:format:] + 139
3 UIKit 0x009434b4 -[UINavigationController _startCustomTransition:] + 988
4 UIKit 0x009500c7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
5 UIKit 0x00950cb9 -[UINavigationController __viewWillLayoutSubviews] + 57
6 UIKit 0x00a8a181 -[UILayoutContainerView layoutSubviews] + 213
7 UIKit 0x00880267 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
8 libobjc.A.dylib 0x0211b81f -[NSObject performSelector:withObject:] + 70
9 QuartzCore 0x01ecd2ea -[CALayer layoutSublayers] + 148
10 QuartzCore 0x01ec10d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
11 QuartzCore 0x01ec0f40 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
12 QuartzCore 0x01e28ae6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
13 QuartzCore 0x01e29e71 _ZN2CA11Transaction6commitEv + 393
14 QuartzCore 0x01e2a544 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
15 CoreFoundation 0x024194ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
16 CoreFoundation 0x0241941f __CFRunLoopDoObservers + 399
17 CoreFoundation 0x023f7344 __CFRunLoopRun + 1076
18 CoreFoundation 0x023f6ac3 CFRunLoopRunSpecific + 467
19 CoreFoundation 0x023f68db CFRunLoopRunInMode + 123
20 GraphicsServices 0x036979e2 GSEventRunModal + 192
21 GraphicsServices 0x03697809 GSEventRun + 104
22 UIKit 0x00815d3b UIApplicationMain + 1225
23 MyApp 0x000022aa main + 138
24 libdyld.dylib 0x02e9f701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Any help in debugging this is appreciate.
P/S: Note the spelling mistake for "orientation" in the console log. I'm leaving it misspelt in case others stumble upon this problem as well.

Please check whether you are having the below functions.If then, please disable those and try,
(BOOL) shouldAutoRotate;
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation;
remove all orientation related methods.
Thanks,
ithay.

Related

NSInternalInconsistencyException - "request for layout attributes for decoration view of kind MSCollectionElementKindCurrentTimeHorizontalGridline

The application I work on is displaying a CollectionView in form of a calendar.
To simplify that we used the MSCollectionViewCalendarLayout from github.
Now it comes with multiple additional decoration views like a red line, which represents the current time in the calendar.
In our implementation there is also the possibility of filtering for different types, so the calendar not always displays the same kind/amount of cells. Unfortunately sometimes the application crashes just out of nowhere, when it should display the red timeline:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'request for layout attributes for decoration view of kind MSCollectionElementKindCurrentTimeHorizontalGridline in section 0 when there are only 0 sections in the collection view'
*** First throw call stack:
(
0 CoreFoundation 0x034761e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02fcb8e5 objc_exception_throw + 44
2 CoreFoundation 0x03476048 +[NSException raise:format:arguments:] + 136
3 Foundation 0x00e2f4de -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x018eb290 -[UICollectionViewData layoutAttributesForDecorationViewOfKind:atIndexPath:] + 228
5 UIKit 0x018b5764 -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] + 242
6 UIKit 0x018a8036 -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:] + 381
7 UIKit 0x018a9775 -[UICollectionView _updateVisibleCellsNow:] + 4730
8 UIKit 0x018ad65f -[UICollectionView layoutSubviews] + 265
9 UIKit 0x012d0964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
10 libobjc.A.dylib 0x02fdd82b -[NSObject performSelector:withObject:] + 70
11 QuartzCore 0x026a445a -[CALayer layoutSublayers] + 148
12 QuartzCore 0x02698244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
13 QuartzCore 0x026980b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
14 QuartzCore 0x025fe7fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
15 QuartzCore 0x025ffb85 _ZN2CA11Transaction6commitEv + 393
16 QuartzCore 0x02600258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
17 CoreFoundation 0x0343e36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
18 CoreFoundation 0x0343e2bf __CFRunLoopDoObservers + 399
19 CoreFoundation 0x0341c254 __CFRunLoopRun + 1076
20 CoreFoundation 0x0341b9d3 CFRunLoopRunSpecific + 467
21 CoreFoundation 0x0341b7eb CFRunLoopRunInMode + 123
22 GraphicsServices 0x049615ee GSEventRunModal + 192
23 GraphicsServices 0x0496142b GSEventRun + 104
24 UIKit 0x01261f9b UIApplicationMain + 1225
25 CariAudit 0x001036ad main + 141
26 libdyld.dylib 0x039d9701 start + 1
27 ??? 0x00000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Now I know that with this custom layout, many people get this error message when they change the underlying data of the collectionView and the solution to this is to call "invalidateLayoutCache" on the layout. The only problem is that I already have that in my code and it gets called before calling reloadData on the collectionView.
Does anyone maybe have an idea/approach for solving this kind of problem?
Thanks
After hours of searching I finally managed to find the error.
The problem was that the MSCollectionViewCalendarLayout missed to empty the Attributes-Dictionaries
currentTimeIndicatorAttributes and currentTimeHorizontalGridlineAttributes.
To fix the error all I had to do was to expand the invalidateLayoutCache method with the following:
[self.currentTimeIndicatorAttributes removeAllObjects];
[self.currentTimeHorizontalGridlineAttributes removeAllObjects];

Zombie Detected - But function never called

What i have Done?
In one of my UIViewController child i have implemented UITableView and have implemented the necessary UITableViewDelegate functions.
What i am Facing?
The issue i am facing is that i get EXC_BAD_ACCESS in Application whenever i relaunch the Controller and tap on Any cell.
What i have Tried?
I have tried to place breakpoints in the function didDeselectRowAtIndexPath: but it never reaches the Breakpoint. I tried Global Exception Breakpoint but it also didn't worked. I checked using the Instruments and found that a zombie is detechted when didDeselectRowAtIndexPath is called but control doesn't reaches the Function.
Instruments Zombie Details Image - Photo Bucket Link
After Implementing the Given Suggestions in the Comments this is the log that i have received
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x023e11e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01fc98e5 objc_exception_throw + 44
2 CoreFoundation 0x02393abc -[__NSArrayM insertObject:atIndex:] + 844
3 CoreFoundation 0x02393760 -[__NSArrayM addObject:] + 64
4 UIKit 0x00bf5782 -[UITableViewIndex _displayTitles] + 1071
5 UIKit 0x00bf58a8 -[UITableViewIndex _cacheAndMeasureTitles] + 171
6 UIKit 0x00bf6213 -[UITableViewIndex sizeThatFits:] + 131
7 UIKit 0x00a18bbc -[UITableView _updateIndexFrameSuppressingChangeNotification:] + 513
8 UIKit 0x00a189b6 -[UITableView _updateIndexFrame] + 41
9 UIKit 0x00a19a5f -[UITableView _updateIndex] + 649
10 UIKit 0x00a336f7 -[UITableView layoutSubviews] + 295
11 UIKit 0x009b3964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
12 libobjc.A.dylib 0x01fdb82b -[NSObject performSelector:withObject:] + 70
13 QuartzCore 0x002ba45a -[CALayer layoutSublayers] + 148
14 QuartzCore 0x002ae244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
15 QuartzCore 0x002ae0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
16 QuartzCore 0x002147fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
17 QuartzCore 0x00215b85 _ZN2CA11Transaction6commitEv + 393
18 QuartzCore 0x00216258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
19 CoreFoundation 0x023a936e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
20 CoreFoundation 0x023a92bf __CFRunLoopDoObservers + 399
21 CoreFoundation 0x02387254 __CFRunLoopRun + 1076
22 CoreFoundation 0x023869d3 CFRunLoopRunSpecific + 467
23 CoreFoundation 0x023867eb CFRunLoopRunInMode + 123
24 GraphicsServices 0x0381a5ee GSEventRunModal + 192
25 GraphicsServices 0x0381a42b GSEventRun + 104
26 UIKit 0x00944f9b UIApplicationMain + 1225
27 MyApplication 0x00001f9c main + 76
28 libdyld.dylib 0x034b3701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
It is pretty clear from all the logs and Zombie images that you are accessing the deallocated CountryListViewController. Keep track on the CountryListViewController and check it is available while you processing your table-view operations.
The better option is, Go to Xcode Menu Product->Scheme->Mange Schemes->Edit (left bottom)-> Debug-> Diagnostics -> Check all the options -> then Run the project.
This will be the Lighthouse to discover your crash.

Xcode 5.1 breakpoints not working

Since today my breakpoints stopped working in Xcode 5.1. I have an unrecognized selector sent to an NSArray, but the debugger does not show the line where the error occurs. It always points to main.m
2014-07-10 20:12:33.827 App[2936:60b] -[__NSArrayI length]: unrecognized selector sent to instance 0xb766da0
2014-07-10 20:12:35.489 App[2936:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI length]: unrecognized selector sent to instance 0xb766da0'
*** First throw call stack:
(
0 CoreFoundation 0x035b61e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018a28e5 objc_exception_throw + 44
2 CoreFoundation 0x03653243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x035a650b ___forwarding___ + 1019
4 CoreFoundation 0x035a60ee _CF_forwarding_prep_0 + 14
5 UIKit 0x00512463 -[UILabel _shadow] + 45
6 UIKit 0x005138c2 -[UILabel drawTextInRect:] + 70
7 UIKit 0x00515dfc -[UILabel drawRect:] + 98
8 UIKit 0x003c4453 -[UIView(CALayerDelegate) drawLayer:inContext:] + 504
9 QuartzCore 0x02a8af39 -[CALayer drawInContext:] + 123
10 QuartzCore 0x02a8ae6a _ZL16backing_callbackP9CGContextPv + 96
11 QuartzCore 0x029794fc CABackingStoreUpdate_ + 2656
12 QuartzCore 0x02a8ae02 ___ZN2CA5Layer8display_Ev_block_invoke + 93
13 QuartzCore 0x02abf2d7 x_blame_allocations + 15
14 QuartzCore 0x02a8ac6d _ZN2CA5Layer8display_Ev + 1519
15 QuartzCore 0x02a8aeb9 -[CALayer _display] + 33
16 QuartzCore 0x02a8a676 _ZN2CA5Layer7displayEv + 144
17 QuartzCore 0x02a8ae93 -[CALayer display] + 33
18 QuartzCore 0x02a7f043 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 323
19 QuartzCore 0x02a7f0bc _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 38
20 QuartzCore 0x029e57fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
21 QuartzCore 0x029e6b85 _ZN2CA11Transaction6commitEv + 393
22 QuartzCore 0x029e7258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
23 CoreFoundation 0x0357e36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
24 CoreFoundation 0x0357e2bf __CFRunLoopDoObservers + 399
25 CoreFoundation 0x0355c254 __CFRunLoopRun + 1076
26 CoreFoundation 0x0355b9d3 CFRunLoopRunSpecific + 467
27 CoreFoundation 0x0355b7eb CFRunLoopRunInMode + 123
28 GraphicsServices 0x038135ee GSEventRunModal + 192
29 GraphicsServices 0x0381342b GSEventRun + 104
30 UIKit 0x00355f9b UIApplicationMain + 1225
31 App 0x00002548 main + 94
32 libdyld.dylib 0x01fe8701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I have tried recreating the breakpoint leaving all options on default. The blue arrow is activated.
'Show disassembly when debugging' is unchecked.
What could be wrong here ?
Check your build setting mode if it is in release mode then change it to debug mode.
If callstack does not tell you anything, try to turn on zombie objects for more detailed memory debug info. Yout can turn it on in menu 'Product -> Scheme -> Edit Scheme ...' than in left panel switch to 'Run $YourProjectName' and at the top panel switch to Diagnostics tab. There is an option under 'Menory Management' section 'Enable Zombie Objects' just turn it on. But be careful and when you find your bug turn it off again becouse these option cause diferent behaviour of memory alocations and releasing objects in memory and may cause an unexpected behaviour of your app.

UISearchBar ios 7 crash on cancel

I am using UITableViewController , in header view of table added search bar. Search and cancel button work fine for me in iOS 6 but in iOS 7 search working fine and when i tapped on cancel button app crash with below message .
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super.'
*** First throw call stack:
(
0 CoreFoundation 0x021f05e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01f738b6 objc_exception_throw + 44
2 CoreFoundation 0x021f0448 +[NSException raise:format:arguments:] + 136
3 Foundation 0x01b53fee -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x00b1f33b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 567
5 libobjc.A.dylib 0x01f8581f -[NSObject performSelector:withObject:] + 70
6 QuartzCore 0x01a392ea -[CALayer layoutSublayers] + 148
7 QuartzCore 0x01a2d0d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
8 QuartzCore 0x01a3b715 -[CALayer(CALayerPrivate) layoutBelowIfNeeded] + 43
9 UIKit 0x00b11c76 -[UIView(Hierarchy) layoutBelowIfNeeded] + 595
10 UIKit 0x00e4be70 -[UISearchDisplayController _hoistSearchBar] + 992
11 UIKit 0x00e4ccb2 -[UISearchDisplayController showHideAnimationDidFinish] + 108
12 UIKit 0x00b00c6c -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 267
13 UIKit 0x00b00f58 -[UIViewAnimationState animationDidStop:finished:] + 80
14 QuartzCore 0x01a34a44 _ZN2CA5Layer23run_animation_callbacksEPv + 304
15 libdispatch.dylib 0x0249f4b0 _dispatch_client_callout + 14
16 libdispatch.dylib 0x0248d75e _dispatch_main_queue_callback_4CF + 340
17 CoreFoundation 0x02255a5e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
18 CoreFoundation 0x021966bb __CFRunLoopRun + 1963
19 CoreFoundation 0x02195ac3 CFRunLoopRunSpecific + 467
20 CoreFoundation 0x021958db CFRunLoopRunInMode + 123
21 GraphicsServices 0x033df9e2 GSEventRunModal + 192
22 GraphicsServices 0x033df809 GSEventRun + 104
23 UIKit 0x00ab4d3b UIApplicationMain + 1225
24 uAlign 0x00001f6d main + 141
25 libdyld.dylib 0x0273170d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I am using storyboard and default cancel button .
Please help on this . Thank you .
Uncheck Use AutoLaout field and try to run it again, see below image:
UITableView's implementation of -layoutSubviews needs to call super.
I think this is the problem.
Check all of your UITableView's layoutSubviews implementation, add [super layoutSubviews];.
- (void)layoutSubviews{
[super layoutSubviews];
//to do other things
}

Application crash after updated to IOS7

I have updated my app to IOS7 and now I have very strange issue.
When I start app it start to do what it suppose to do and after 3-5 minutes app stops to work. But not completely. It stops to send notifications, track location etc.
And if I try to make some action I get this in console:
*** First throw call stack:
(
0 CoreFoundation 0x0305f5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0276e8b6 objc_exception_throw + 44
2 CoreFoundation 0x0305f3bb +[NSException raise:format:] + 139
3 UIKit 0x0157465c -[UINib instantiateWithOwner:options:] + 951
4 UIKit 0x013e6c95 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
5 UIKit 0x013e743d -[UIViewController loadView] + 302
6 UIKit 0x013e773e -[UIViewController loadViewIfRequired] + 78
7 UIKit 0x0140d1a5 -[UINavigationController _layoutViewController:] + 39
8 UIKit 0x0140d6bb -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
9 UIKit 0x0140d7b3 -[UINavigationController _startTransition:fromViewController:toViewController:] + 78
10 UIKit 0x0140e72c -[UINavigationController _startDeferredTransitionIfNeeded:] + 645
11 UIKit 0x0140f349 -[UINavigationController __viewWillLayoutSubviews] + 57
12 UIKit 0x0154839d -[UILayoutContainerView layoutSubviews] + 213
13 UIKit 0x0cf0656f -[UILayoutContainerViewAccessibility(SafeCategory) layoutSubviews] + 50
14 UIKit 0x0133edd7 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
15 libobjc.A.dylib 0x0278081f -[NSObject performSelector:withObject:] + 70
16 QuartzCore 0x00ef972a -[CALayer layoutSublayers] + 148
17 QuartzCore 0x00eed514 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
18 QuartzCore 0x00eed380 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
19 QuartzCore 0x00e55156 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
20 QuartzCore 0x00e564e1 _ZN2CA11Transaction6commitEv + 393
21 QuartzCore 0x00f12870 +[CATransaction flush] + 52
22 UIKit 0x012f0979 _afterCACommitHandler + 131
23 CoreFoundation 0x0302753e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
24 CoreFoundation 0x0302748f __CFRunLoopDoObservers + 399
25 CoreFoundation 0x030053b4 __CFRunLoopRun + 1076
26 CoreFoundation 0x03004b33 CFRunLoopRunSpecific + 467
27 CoreFoundation 0x0300494b CFRunLoopRunInMode + 123
28 GraphicsServices 0x03ce89d7 GSEventRunModal + 192
29 GraphicsServices 0x03ce87fe GSEventRun + 104
30 UIKit 0x012d494b UIApplicationMain + 1225
31 MyApp 0x0000759d main + 141
32 libdyld.dylib 0x02c53725 start + 0
33 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Any idea what is this?
App works fine in IOS6.
Create an exception breakpoint in Xcode that stops on all exceptions. Then the debugger will stop when that exception is raised. It looks like it is in
[UINib instantiateWithOwner:options:]
But I can't tell if you are calling that or the system.
See here for a related issue:
Terminating app due to uncaught exception 'NSUnknownKeyException'
I must test this on real phone just to be sure.
I have a piece of code that refreshes some labels in the view every X seconds.
It works fine until IOS7. On IOS7 app crashes after 3 minutes and I get the error from the question.
Every time I refresh labels in the view I was opened a new connection to sqlite to get data.
In IOS7 I get error so I made one instance of data access class and init it only in viewDidLoad() and now it works fine.
If after test I confirm that I am right I will definitely make singleton pattern of my data access class.

Resources