App Crashes When Navigating Away from Loading Collection View - ios

Scenario: UINavigationViewController contains UICollectionViewControllers. Each collection view needs to get its data from a JSON API, which can take a bit of time. Then each cell in the collection view sends its own requests to the server, getting thumbnail images. (For clarity, I created a sequence diagram to show how I am doing this, not including the thumbnail requests, which I have disabled for debugging).
This is what the code looks like:
-(void)buildDisplayItems
{
NSLog(#"Collection VC (object: %#) with collection (object: %#) building display items on thread %# (main thread: %c)", self, self.showingCollection, [NSThread currentThread], [NSThread isMainThread]);
[self.showingCollection buildDisplayItemsWithPhotoBatch:self.nextBatch++]; // <-- this waits for the server request to be made, come back and get processed into arrays before returning.
self.photos = self.showingCollection.photos;
self.collections = self.showingCollection.subcategories;
// Past this point, I cannot think of how these arrays would possibly get changed to trigger the 'mutated while being enumerated' errors.
[self.collectionView reloadData];
}
The problem is if the user navigates back on the navigation view at JUST THE RIGHT TIMES, I get one of the following errors:
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <NSConcreteMapTable: 0x1f047c80> was mutated while being enumerated.'
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSSetM: 0x203f26b0> was mutated while being enumerated.'
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[3]'
To make these errors happen, I have to try 3-4 times selecting some item so its collection view gets pushed on the nav stack then quickly pressing the back button. Obviously, my first impression from the first two errors was that the data source arrays are getting modified somehow, but there's NO WAY anything I wrote is doing that. Then I thought maybe the fact that the thumbnail images for each cell is getting loaded after cellForItemAtIndexPath returns it is the problem, so I disabled that, but nothing changed.
I sprinkled some NSLogs around and found that this is happening while the collection view is making calls to its delegate methods. I made sure to add the following:
-(void)viewWillDisappear:(BOOL)animated
{
if (self.showingCollection != nil) {
[self.showingCollection cancelOperations]; //for network requests
NSLog(#"Collection VC (object: %#) will disappear", self);
}
}
-(void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
self.collectionView.delegate = nil;
self.collectionView.dataSource = nil;
self.collectionView = nil;
}
But this hasn't helped in stopping the errors. In fact, some times when the crash happens, there is no "Collection VC will disappear" log message.
The other problem is that these errors occur and the debugger stops in the main function at the UIApplicationMain line (this is with 'break on all exceptions' breakpoint), so I have no way of pinpointing how the error gets triggered. I have enabled zombies but there's no log message from them. (EDIT: Sometimes it actually stops in an empty thread, saying "error: address doesn't contain a section that points to a section in a object file")
How do I set up these collection views so that pressing the back button quickly doesn't end the world?
EDIT
How can I find out what is the collection that is being changed while being enumerated?
UPDATE
I found this SO thread talking about not being able to get stack traces. Every time I got one of the exceptions above, it'd give me a stack trace like
*** First throw call stack:
(0x327453e7 0x3a440963 0x32744ec1 0x330f72c7 0x330f769b 0x330f825b 0x330fa0c7 0x330faefd 0x33103cab 0x3498c519 0x3498d5f1 0x3498d915 0x349920d9 0x34991fe3 0x3268bacd 0x34991f97 0x3268bacd 0x34991f97 0x3268bacd 0x34991f97 0x3268bacd 0x34991f97 0x3268bacd 0x34991f97 0x3268bacd 0x34991f97 0x330fa997 0x3498bf3d 0x345c73dd 0x34303513 0x343030b5 0x34303fd9 0x343039c3 0x343037d5 0x3434a567 0x3a87febb 0x3a87fb93 0x3a898fb8 0x32fe5fc7 0x3305d24f 0x3a88d0e1 0x3a88cfa8)
libc++abi.dylib: terminate called throwing an exception
As per that thread's suggestion I implemented my own uncaught exception handler and it prints out the following stack trace:
0 CoreFoundation 0x327453ff <redacted> + 186
1 libobjc.A.dylib 0x3a440963 objc_exception_throw + 30
2 CoreFoundation 0x32744ec1 <redacted> + 0
3 Foundation 0x330f72c7 <redacted> + 422
4 Foundation 0x330f769b <redacted> + 298
5 Foundation 0x330f825b <redacted> + 202
6 Foundation 0x330fa0c7 <redacted> + 242
7 Foundation 0x330faefd <redacted> + 500
8 Foundation 0x33103cab <redacted> + 390
9 UIKit 0x3498c519 <redacted> + 128
10 UIKit 0x3498d5f1 <redacted> + 196
11 UIKit 0x3498d915 <redacted> + 88
12 UIKit 0x349920d9 <redacted> + 84
13 UIKit 0x34991fe3 <redacted> + 182
14 CoreFoundation 0x3268bacd CFArrayApplyFunction + 176
15 UIKit 0x34991f97 <redacted> + 106
16 CoreFoundation 0x3268bacd CFArrayApplyFunction + 176
17 UIKit 0x34991f97 <redacted> + 106
18 CoreFoundation 0x3268bacd CFArrayApplyFunction + 176
19 UIKit 0x34991f97 <redacted> + 106
20 CoreFoundation 0x3268bacd CFArrayApplyFunction + 176
21 UIKit 0x34991f97 <redacted> + 106
22 CoreFoundation 0x3268bacd CFArrayApplyFunction + 176
23 UIKit 0x34991f97 <redacted> + 106
24 CoreFoundation 0x3268bacd CFArrayApplyFunction + 176
25 UIKit 0x34991f97 <redacted> + 106
26 Foundation 0x330fa997 <redacted> + 166
27 UIKit 0x3498bf3d <redacted> + 124
28 UIKit 0x345c73dd <redacted> + 72
29 QuartzCore 0x34303513 <redacted> + 214
30 QuartzCore 0x343030b5 <redacted> + 460
31 QuartzCore 0x34303fd9 <redacted> + 16
32 QuartzCore 0x343039c3 <redacted> + 238
33 QuartzCore 0x343037d5 <redacted> + 316
34 QuartzCore 0x3434a567 <redacted> + 170
35 libsystem_c.dylib 0x3a87febb _pthread_tsd_cleanup + 174
36 libsystem_c.dylib 0x3a87fb93 <redacted> + 118
37 libsystem_c.dylib 0x3a898fb8 pthread_exit + 27
38 Foundation 0x32fe5fc7 <redacted> + 10
39 Foundation 0x3305d24f <redacted> + 1002
40 libsystem_c.dylib 0x3a88d0e1 <redacted> + 308
41 libsystem_c.dylib 0x3a88cfa8 thread_start + 8

1: When you navigate away from the view controller with the collection view, are you nil'ing the delegate references and data sources in the collection view so you no longer get queried?
This happens with Table Views also, the objects still persist but the data or sources do not.
2: I also recommend using #synchronized(self) when modifying the collections. So that code that sets and reads it does not clash (the enumerated crash)

Related

what causes my app crashing when coming back to screen?

I have listing of videos in UITableView which uses custom class. This is tabbar application. When I scroll down to 8th video, and go to next screen and when I come back to video listing screen, the app crashes. I tried to debug but cannot figure out the issue. This is what I get from debugger.
2016-06-08 12:47:46.919 Votocast[2283:453809] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 8 beyond bounds for empty array'
*** First throw call stack:
(
0 CoreFoundation 0x0000000108ba9d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010a7f9deb objc_exception_throw + 48
2 CoreFoundation 0x0000000108a87804 -[__NSArrayM objectAtIndex:] + 212
3 Votocast 0x0000000107dfd4de -[HomeView tableView:cellForRowAtIndexPath:] + 958
4 UIKit 0x000000010b6914f4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766
5 UIKit 0x000000010b69162c -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
6 UIKit 0x000000010b665c8a -[UITableView _updateVisibleCellsNow:isRecursive:] + 2799
7 UIKit 0x000000010b69a686 -[UITableView _performWithCachedTraitCollection:] + 92
8 UIKit 0x000000010b681344 -[UITableView layoutSubviews] + 224
9 UIKit 0x000000010b5ee980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
10 QuartzCore 0x0000000109ff1c00 -[CALayer layoutSublayers] + 146
11 QuartzCore 0x0000000109fe608e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
12 QuartzCore 0x0000000109fe5f0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
13 QuartzCore 0x0000000109fda3c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
14 QuartzCore 0x000000010a008086 _ZN2CA11Transaction6commitEv + 486
15 UIKit 0x000000010b52e72e _UIApplicationHandleEventQueue + 7135
16 CoreFoundation 0x0000000108acf301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x0000000108ac522c __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x0000000108ac46e3 __CFRunLoopRun + 867
19 CoreFoundation 0x0000000108ac40f8 CFRunLoopRunSpecific + 488
20 GraphicsServices 0x000000010d4ebad2 GSEventRunModal + 161
21 UIKit 0x000000010b533f09 UIApplicationMain + 171
22 Votocast 0x0000000107e48d8f main + 111
23 libdyld.dylib 0x000000010cc0792d start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
In viewWillAppear, I remove all objects from this array and call webservice. But before I get response from webservice, app crashes to a line in cellForRowAtIndexPath. Your little help will be appreciated.
EDIT:
I have noticed that app only crashes when my tableview decelerationrate and I go to next screen and comeback to video listing screen. I have not done any type of code regarding decelerationration.
Clearly your datasource delegate isn't working properly. If you empty an array that is used by the datasource, then you must call reloadData. And when you get new data, you call reloadData again.
However, you shouldn't refresh data that way. You should display the old data until new data arrives.
You Clear all the object From Array in viewWillAppear Method But, do you Reload the tableview after that.
because this can cause the crash. you remove all the object but tableview tries to goto the last scrolled index. so it cause the crash.
Hope this will help You.
Thank you guys. I fixed it. I actually was allocating array in viewDidLoad and was just removing objects from that array in viewWillAppear. So I preserve my data and not calling webservice in viewWillAppear.

How Do I Fix: Terminating app due to uncaught exception 'NSUnknownKeyException'

I've read that other people have had similar uncaught exceptions, however most seem to be caused by a missing outlet connection. I don't believe mine is related to IBOutlets because the VC runs fine in most scenarios and so do my other VCs.
I think it has to do with Core Data. Here's the error, which I believe occurs in my table's cellForRowAtIndexPath:
2016-01-05 15:18:14.947 Do List[1476:81278] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSManagedObject 0x7fbb89e7cc50> valueForUndefinedKey:]: the entity TomTask is not key value coding-compliant for the key "completedDate".'
*** First throw call stack:
(
0 CoreFoundation 0x0000000102b5ee65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104cfddeb objc_exception_throw + 48
2 CoreFoundation 0x0000000102b5eaa9 -[NSException raise] + 9
3 CoreData 0x0000000102757ec1 -[NSManagedObject valueForUndefinedKey:] + 289
4 Do List 0x000000010235b9d6 _TFC7Do_List24AllocationViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 2630
5 Do List 0x000000010235c24f _TToFC7Do_List24AllocationViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 79
6 UIKit 0x0000000103933e43 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766
7 UIKit 0x0000000103933f7b -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
8 UIKit 0x0000000103908a39 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2996
9 UIKit 0x000000010393d01c -[UITableView _performWithCachedTraitCollection:] + 92
10 UIKit 0x0000000103923edc -[UITableView layoutSubviews] + 224
11 UIKit 0x00000001038914a3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
12 QuartzCore 0x000000010369659a -[CALayer layoutSublayers] + 146
13 QuartzCore 0x000000010368ae70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
14 QuartzCore 0x000000010368acee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
15 QuartzCore 0x000000010367f475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
16 QuartzCore 0x00000001036acc0a _ZN2CA11Transaction6commitEv + 486
17 UIKit 0x00000001037d4f7c _UIApplicationHandleEventQueue + 7329
18 CoreFoundation 0x0000000102a8aa31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
19 CoreFoundation 0x0000000102a8095c __CFRunLoopDoSources0 + 556
20 CoreFoundation 0x0000000102a7fe13 __CFRunLoopRun + 867
21 CoreFoundation 0x0000000102a7f828 CFRunLoopRunSpecific + 488
22 GraphicsServices 0x0000000106bb7ad2 GSEventRunModal + 161
23 UIKit 0x00000001037da610 UIApplicationMain + 171
24 Do List 0x0000000102368fad main + 109
25 libdyld.dylib 0x000000010a52392d start + 1
26 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
A Few Notes
There's a particular set of VCs that, if run in a particular order, cause this error.
The error occurs when I go from A -> B -> C, then try to unwind to A.
If you look at the exception stack above, the error is happening in the cellForRowAtIndexPath of the allocViewController. That VC is B ,so it shouldn't be loading, just being unwound through.
It references "CompletedDate" which is the new thing I added yesterday that kick this whole thing off. CompletedDate was an existing CoreData attribute which I just started showing in view controller C.
If you look at the first line of the error, it looks like you have a class called TomTask which you're trying to use the "completedDate" from, but there isn't a "completedDate" in TomTask.
It appears (from entry #4 in your call stack) you're trying to do this in your tableView:cellForRowAtIndexPath: method of that view controller.

Crash when Fetched Results Controller updates table after saving a background MOC

I have a tableView hooked up to a FRC (Fetched Results Controller) , I also have two contexts , namely backgroundContext initialised in a private queue and a mainContext initialised on the main queue. I also have setup the didSaveNotification to pass the objects from one context to another. When ever i save some data in the backgroundContext it saves successfully and FRC updates ,but if i repeat the process again the app crashes with an error
'The left hand side for an ALL or ANY operator must be either an
NSArray or an NSSet.'
The saving is done through a form which is presented modally. The same viewController works fine if presented in other viewControllers . but crashes only in one particular one. But again other that presenting the Form no other extra stuff is being done.
Here's my entire crash report.
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'The left hand side for an ALL
or ANY operator must be either an NSArray or an NSSet.'
* First throw call stack: ( 0 CoreFoundation 0x0000000103575495 exceptionPreprocess + 165 1 libobjc.A.dylib
0x0000000102fbb99e objc_exception_throw + 43 2 Foundation
0x00000001003c706b -[NSPredicateOperator
performOperationUsingObject:andObject:] + 826 3 Foundation
0x00000001003c6c1e -[NSComparisonPredicate
evaluateWithObject:substitutionVariables:] + 314 4 Foundation
0x00000001003c6ae2 -[NSPredicate evaluateWithObject:] + 19 5
CoreData 0x0000000102d61d06
-[NSFetchedResultsController(PrivateMethods) _objectInResults:] + 102 6 CoreData 0x0000000102d630f7
-[NSFetchedResultsController(PrivateMethods) _preprocessUpdatedObjects:insertsInfo:deletesInfo:updatesInfo:sectionsWithDeletes:newSectionNames:treatAsRefreshes:]
+ 519 7 CoreData 0x0000000102d642d5 -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 1781 8 CoreFoundation 0x00000001035cad9c
__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12 9 CoreFoundation 0x000000010352d51d
_CFXNotificationPost + 2381 10 Foundation 0x000000010035b7fa -[NSNotificationCenter
postNotificationName:object:userInfo:] + 68 11 CoreData
0x0000000102c9048a
-[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 74 12 CoreData 0x0000000102d16c8b
-[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:]
+ 331 13 CoreData 0x0000000102c8c9cc -[NSManagedObjectContext(_NSInternalChangeProcessing) _postRefreshedObjectsNotificationAndClearList] + 108 14 CoreData 0x0000000102c8c5e4
-[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 2804 15 CoreData 0x0000000102c663cb _performRunLoopAction + 267 16 CoreFoundation
0x0000000103540dc7
CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 17 CoreFoundation 0x0000000103540d37
__CFRunLoopDoObservers + 391 18 CoreFoundation 0x0000000103520522 __CFRunLoopRun + 946 19 CoreFoundation
0x000000010351fd83 CFRunLoopRunSpecific + 467 20 GraphicsServices
0x00000001037ecf04 GSEventRunModal + 161 21 UIKit
0x00000001011bde33 UIApplicationMain + 1010 22 Expense_Manager
0x0000000100001d13 main + 115 23 libdyld.dylib
0x000000010420c7e1 start + 0 ) libc++abi.dylib: terminating with
uncaught exception of type NSException
Thanks in advance.
Okay i actually found out why this was happening a few days ago. There was a notification being fired off when the form dismissed which reloaded a tableView from another viewController hooked up to an FRC sharing the same context. Once I removed itself as an observer in viewDidDisappear it did not crash. :) I hope this helps incase someone is facing the same problem.

Removing an object at a NSMutableArray causes a crash

Attempting to remove an object at a NSMutableArray causes a crash:
2014-03-07 18:58:03.755 HomeWork Pro +[12637:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI removeObjectAtIndex:]: unrecognized selector sent to instance 0xa2f4c20'
remove object code:
[hwArray removeObjectAtIndex:self.indexPath.row];
This only happens if I do it with self.indexPath.row, if I do it with a number it functions normally. I know the self.indexPath.row is not nil, I've NSlogged it to be sure and it turnde right. After doing that I do
[table reloadData]
to reload the UITableView data and the methods.
Any clue on what's the issue here?
Call stack
*** First throw call stack:
(
0 CoreFoundation 0x017aa5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0152d8b6 objc_exception_throw + 44
2 CoreFoundation 0x01847903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0179a90b ___forwarding___ + 1019
4 CoreFoundation 0x0179a4ee _CF_forwarding_prep_0 + 14
5 HomeWork Pro + 0x00006c88 -[HomeWork SelfDelete] + 216
6 HomeWork Pro + 0x0000711a -[HomeWork done:] + 618
7 libobjc.A.dylib 0x0153f874 -[NSObject performSelector:withObject:withObject:] + 77
8 UIKit 0x0029d0c2 -[UIApplication sendAction:to:from:forEvent:] + 108
9 UIKit 0x0029d04e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
10 UIKit 0x003950c1 -[UIControl sendAction:to:forEvent:] + 66
11 UIKit 0x00395484 -[UIControl _sendActionsForEvents:withEvent:] + 577
12 UIKit 0x00394733 -[UIControl touchesEnded:withEvent:] + 641
13 UIKit 0x002da51d -[UIWindow _sendTouchesForEvent:] + 852
14 UIKit 0x002db184 -[UIWindow sendEvent:] + 1232
15 UIKit 0x002aee86 -[UIApplication sendEvent:] + 242
16 UIKit 0x0029918f _UIApplicationHandleEventQueue + 11421
17 CoreFoundation 0x0173383f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
18 CoreFoundation 0x017331cb __CFRunLoopDoSources0 + 235
19 CoreFoundation 0x0175029e __CFRunLoopRun + 910
20 CoreFoundation 0x0174fac3 CFRunLoopRunSpecific + 467
21 CoreFoundation 0x0174f8db CFRunLoopRunInMode + 123
22 GraphicsServices 0x023349e2 GSEventRunModal + 192
23 GraphicsServices 0x02334809 GSEventRun + 104
24 UIKit 0x0029bd3b UIApplicationMain + 1225
25 HomeWork Pro + 0x00008bad main + 141
26 libdyld.dylib 0x02c8a70d start + 1
27 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
It looks to me like the crash message you posted and your stack trace do not match. The stack trace shows an "unrecognized selector" crash in the making, but the crash message shows that you were attempting to insert a nil object into an array.
Neither of those things matches the line of code that you posted. (removing an object from an array.) I guess you could get an unrecognized selector error from the line of source you posted if the array wasn't really a mutable array...
EDIT:
Based on your updated question, it's clear. Your array is not actually a mutable array even though you think it is.
Post the code that creates the array.
If you're copying it somewhere, look at that code carefully. If you're loading it from a plist or an archive, be aware that mutable arrays come back as immutable when you read them back in.
What you have is an immutable NSArray. What you want is an NSMutableArray, which actually does implement removeObjectAtIndex:. Make sure your array isn't getting replaced with an immutable version at some point.

Exception could not understand in iphone

Hey can anyone help me out that what type of exception is this i had earlier a code and link is as: Application run on simulator but not on device in iphone
can anybody here who can tell that what type of exception is in it? is there any memory leak?
here is the log below:
2013-12-27 17:53:26.814 Skirr[1346:a0b] Application windows are expected to have a root view controller at the end of application launch
2013-12-27 17:53:27.995 Skirr[1346:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
0 CoreFoundation 0x032745e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x021b88b6 objc_exception_throw + 44
2 CoreFoundation 0x03228316 -[__NSPlaceholderArray initWithObjects:count:] + 390
3 CoreFoundation 0x0324bce9 +[NSArray arrayWithObject:] + 73
4 Skirr 0x000093bd -[SlideViewController viewDidLoad] + 1597
5 UIKit 0x00e2d318 -[UIViewController loadViewIfRequired] + 696
6 UIKit 0x00e2d5b4 -[UIViewController view] + 35
7 UIKit 0x00e473e2 -[UINavigationController _startCustomTransition:] + 778
8 UIKit 0x00e540c7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
9 UIKit 0x00e54cb9 -[UINavigationController __viewWillLayoutSubviews] + 57
10 UIKit 0x00f8e181 -[UILayoutContainerView layoutSubviews] + 213
11 UIKit 0x00d84267 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
12 libobjc.A.dylib 0x021ca81f -[NSObject performSelector:withObject:] + 70
13 QuartzCore 0x005622ea -[CALayer layoutSublayers] + 148
14 QuartzCore 0x005560d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
15 QuartzCore 0x00555f40 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
16 QuartzCore 0x004bdae6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
17 QuartzCore 0x004bee71 _ZN2CA11Transaction6commitEv + 393
18 QuartzCore 0x004bf544 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
19 CoreFoundation 0x0323c4ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
20 CoreFoundation 0x0323c41f __CFRunLoopDoObservers + 399
21 CoreFoundation 0x0321a344 __CFRunLoopRun + 1076
22 CoreFoundation 0x03219ac3 CFRunLoopRunSpecific + 467
23 CoreFoundation 0x032198db CFRunLoopRunInMode + 123
24 GraphicsServices 0x034ce9e2 GSEventRunModal + 192
25 GraphicsServices 0x034ce809 GSEventRun + 104
26 UIKit 0x00d19d3b UIApplicationMain + 1225
27 Skirr 0x000055a2 main + 130
28 libdyld.dylib 0x06896725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
have look at this link from
attempt to insert nil object from objects[0]
you are inserting or handling nil object you can get that line refer given above link
The error
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
is occurring because you are trying to add nil value to an NSArray. After looking through your code on the other question the specific line of code that it is crashing on is
[_slideNavigationController setViewControllers:[NSArray arrayWithObject:initalViewController] animated:NO];
It is crashing here because of one of two things
1) initalViewController is nil so when you add it using arrayWithObject it crashes.
or
2) setViewControllers:[NSArray arrayWithObject:initalViewController] is causing the error because [NSArray arrayWithObject:initalViewController] is setting nil to the method setViewControllers: method which takes an NSArray.
I would say it is option (1) that is causing your issue though as the crash happens when arrayWithObject is called.
Check your main.m. The last argument should be set to the name of the class that implements the UIApplicationDelegate protocol OR you can try for last argument like NSStringFromClass([AppDelegate class]).
Please check this link it might help you .
click here

Resources