iOS app crashing on [NSNull hasColorGlyphsInRange:attributes:] - ios

I'm facing this exception, and i'm not being able to figure out the problem.
i tried adding exception breakpoint and symbolic breakpoint but it didn't show any more useful data. it's crashing on the main.h return with nothing in the backtrace
this is the exception:
2016-10-20 17:32:58.615 <AppName>[15655:3398242] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull hasColorGlyphsInRange:attributes:]: unrecognized selector sent to instance 0x10b1acfb0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010aeef34b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010f90221e objc_exception_throw + 48
2 CoreFoundation 0x000000010af5ef34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010ae74c15 ___forwarding___ + 1013
4 CoreFoundation 0x000000010ae74798 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010d9c66c1 -[UILabel _determineContentsFormat] + 1475
6 UIKit 0x000000010d9c6f9d -[UILabel _evaluateContentsFormat] + 33
7 UIKit 0x000000010d801923 -[UIView(CALayerDelegate) layerWillDraw:] + 65
8 QuartzCore 0x000000010d2c0b26 _ZN2CA5Layer8display_Ev + 146
9 QuartzCore 0x000000010d2b5596 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 294
10 QuartzCore 0x000000010d2b5629 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 35
11 QuartzCore 0x000000010d24362c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
12 QuartzCore 0x000000010d270713 _ZN2CA11Transaction6commitEv + 475
13 QuartzCore 0x000000010d271083 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
14 CoreFoundation 0x000000010ae93e17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
15 CoreFoundation 0x000000010ae93d87 __CFRunLoopDoObservers + 391
16 CoreFoundation 0x000000010ae78b9e __CFRunLoopRun + 1198
17 CoreFoundation 0x000000010ae78494 CFRunLoopRunSpecific + 420
18 GraphicsServices 0x0000000111c6fa6f GSEventRunModal + 161
19 UIKit 0x000000010d73df34 UIApplicationMain + 159
20 AppName 0x0000000109998c73 main + 1187
21 libdyld.dylib 0x00000001103f368d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

'-[NSNull hasColorGlyphsInRange:attributes:]: unrecognized selector sent to instance 0x10b1acfb0'
This means you've used a NSNull object. From the call stack, maybe a NSNull used as NSString or NSAttributedString. So you need check it before use it.
if (str != [NSNull null]) {
label.text = str
}

are you use this function hasColorGlyphsInRange if you use
try
if ([self respondsToSelector:#selector(hasColorGlyphsInRange:)]) {
//code
}

You need to be able to read and understand error messages.
You are told that someone or something tried to send a message hasColorGlyphsInRange to an instance of NSNull. Even if it is hard to accept because that shouldn't happen, that's the error message and that's what happened.
So you have put an NSNull instance somewhere where you shouldn't have. hasColorGlyphsInRange doesn't seem documented anywhere, so it's something internal to iOS or macOS. But it very much looks like something about text, and there are UILabel methods on the call stack. And there is a layerWillDraw: on the call stack, so it's something trying to draw a UILabel.
UILabels don't get redrawn immediately, but when the system decides to redraw anything. So the most likely thing is that you have set the text of a UILabel to an NSNull object.
And where does the NSNull object come from? Bets are that you are processing JSON and you assume that you are getting a string and don't check for null objects, and that's why you are setting the text of some UILabel to an NSNull instance.

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.

-[__NSArrayI addObject:]: unrecognized selector sent to instance

I have this code:
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
var array: AnyObject = []
for obj in Category.allObjects() {
if var add = obj as? Category {
array.addObject(add.name)
println(add.name)
}
}
return String(array[section] as String)
}
Im using a Realm database and I am trying to get one of the columns of the database to print in the section headers. Im also using a the same process for all the other required UITableView methods eg/ numberOfSectionsInTable etc etc. The code is giving me this error:
2014-10-26 20:47:33.479 Project[14631:937721] -[__NSArrayI addObject:]: unrecognized selector sent to instance 0x7fdaf270ddb0
2014-10-26 20:47:33.481 Project[14631:937721] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI addObject:]: unrecognized selector sent to instance 0x7fdaf270ddb0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109960f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001095f9bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010996804d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001098c027c ___forwarding___ + 988
4 CoreFoundation 0x00000001098bfe18 _CF_forwarding_prep_0 + 120
5 BuildersUtility 0x0000000108d7f720 _TFC15BuildersUtility29ProductsDetailsViewController27numberOfSectionsInTableViewfS0_FCSo11UITableViewSi + 1408
6 BuildersUtility 0x0000000108d7f8ca _TToFC15BuildersUtility29ProductsDetailsViewController27numberOfSectionsInTableViewfS0_FCSo11UITableViewSi + 58
7 UIKit 0x000000010a478a7e -[UITableViewRowData _updateNumSections] + 84
8 UIKit 0x000000010a479474 -[UITableViewRowData invalidateAllSections] + 69
9 UIKit 0x000000010a2cdb03 -[UITableView _updateRowData] + 214
10 UIKit 0x000000010a2e300f -[UITableView numberOfSections] + 27
11 UIKit 0x000000010a4e0645 -[UITableViewController viewWillAppear:] + 97
12 UIKit 0x000000010a327821 -[UIViewController _setViewAppearState:isAnimating:] + 487
13 UIKit 0x000000010a352960 -[UINavigationController _startTransition:fromViewController:toViewController:] + 776
14 UIKit 0x000000010a353487 -[UINavigationController _startDeferredTransitionIfNeeded:] + 523
15 UIKit 0x000000010a353f47 -[UINavigationController __viewWillLayoutSubviews] + 43
16 UIKit 0x000000010a499509 -[UILayoutContainerView layoutSubviews] + 202
17 UIKit 0x000000010a277973 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
18 QuartzCore 0x000000010a089de8 -[CALayer layoutSublayers] + 150
19 QuartzCore 0x000000010a07ea0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
20 QuartzCore 0x000000010a07e87e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x0000000109fec63e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
22 QuartzCore 0x0000000109fed74a _ZN2CA11Transaction6commitEv + 390
23 QuartzCore 0x0000000109feddb5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
24 CoreFoundation 0x0000000109895dc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x0000000109895d20 __CFRunLoopDoObservers + 368
26 CoreFoundation 0x000000010988bb53 __CFRunLoopRun + 1123
27 CoreFoundation 0x000000010988b486 CFRunLoopRunSpecific + 470
28 GraphicsServices 0x000000010dec79f0 GSEventRunModal + 161
29 UIKit 0x000000010a1fe420 UIApplicationMain + 1282
30 BuildersUtility 0x0000000108d9589e top_level_code + 78
31 BuildersUtility 0x0000000108d958da main + 42
32 libdyld.dylib 0x000000010baaf145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
BTW if you have a better way for me to extract the code from the database for a project like this please chirp in! :)
Thanks in Advance
allObjects will return you an instance of RLMResults, which is one of the two list types in Realms, the other being RLMArray. They are both made to be similar to NSArrays or swift arrays, and implement a protocol called RLMCollection. Among other things, that means you can access its elements with normal [i] notation. So you can simply write
return Category.allObjects()[section].name
although you might want to do some checking before you return. Also, it is generally not advisable to repeat the allObjects() query more than you need to, so you could cache in a lazy instance variable or similar. In this case there probably aren't that many categories/section headers, so it shouldn't be an issue.
More importantly, keep in mind that although the RLMResults list you get back is ordered in the sense that it is an ordered list, there is no inherent order among the Category instances in the Realm, so the next time you do Category.allObjects() you are not really guaranteed to receive the objects in the same order. So what you should do is really to create an RLMArray of Category objects and make that a property of another object. Then the order will be preserved.
It is because AnyObject does not support the method addObject
I think what you have in mind is that you want the variable array to be an array of type AnyObject.
You should declare it this way:
var array:[AnyObject] = []
And then when you want to add anything to the array, do this:
array.append(add.name)
In addition to what #AnthonyKong is pointing out, it is a bit unclear from the above code why you would want an array of AnyObject in the first place.
var array = [AnyObject]()
It seems what you actually want is an array of String?
var array = [String]()
then your return statement is simplified down to:
return array[section]
When feeling up to it you might also look into filter to rip out some of that almost-boiler-plate-logic in your code.
I had a similar problem but with an NSMutableArray. Thanks to #Gusutafu's comment above that setting an array to #[] converts it to an NSArray.
My incorrect code (selectedTags is an NSMutableArray):
selectedTags = ([theInputParameters valueForKey:kAcronymTagsSelectedTags] != nil)
? [theInputParameters valueForKey:kAcronymTagsSelectedTags]
: #[];
This gave the error -[__NSArrayI addObject:]: unrecognized selector sent to instance when I tried to add an object.
My corrected code
selectedTags = ([theInputParameters valueForKey:kAcronymTagsSelectedTags] != nil)
? [theInputParameters valueForKey:kAcronymTagsSelectedTags]
: [NSMutableArray arrayWithArray:#[]];

Push from navigation controller after do something in background

I create a method to do something in background and manipulate ui on foreground. In background i still do nothing right now/ but later i want to take one core data object and On foreground i push from active navigation controller.
When I do that I got this error :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
This is a piece of my code :
[[NSOperationQueue new] addOperationWithBlock:^{
[[NSOperationQueue mainQueue]addOperationWithBlock:^{
//theCatalog is not nil here just FYI
PO1(theCatalog); //just for log the catalog object
[theCatalog showImageForThisCatalogwithNavigationController:self.delegateBGCatalogSearchTableCellResultProtocol.navigationController withPage:pageNumber];
}];
}];
But when i just call this, my code doesn't give error like that.
[theCatalog showImageForThisCatalogwithNavigationController:self.delegateBGCatalogSearchTableCellResultProtocol.navigationController withPage:pageNumber];
Basically, the code simply won't run in any block.
I can run
[theCatalog showImageForThisCatalogwithNavigationController:self.delegateBGCatalogSearchTableCellResultProtocol.navigationController withPage:pageNumber]; just fine
Bit if I run
[[NSOperationQueue mainQueue]addOperationWithBlock:^{
[theCatalog showImageForThisCatalogwithNavigationController:self.delegateBGCatalogSearchTableCellResultProtocol.navigationController withPage:pageNumber];
//theCatalog is not nil here just FYI
}];
Which is almost equivalent, then I got that error. I can't know where the error is. I just get redirected to main() and the program crash there.
This is the full error code
2014-09-18 18:15:52.808 [1735:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x2f262fd3 0x39a0fccf 0x2f19cf9d 0x31b15c6f 0x31b15aab 0x31b15633 0x31b2cf49 0x31b2cb8d 0x31b2cb25 0x31a7ed79 0x316fc62b 0x316f7e3b 0x316f7ccd 0x316f76df 0x316f74ef 0x316f121d 0x2f22e2a5 0x2f22bc49 0x2f22bf8b 0x2f196f4f 0x2f196d33 0x3409b663 0x31ae216d 0xc91cd 0x39f1cab7)
Perhaps numbers below First throw call stack, which are (0x2f262fd3 0x39a0fccf 0x2f19cf9d 0x31b15c6f 0x31b15aab 0x31b15633 0x31b2cf49 0x31b2cb8d 0x31b2cb25 0x31a7ed79 0x316fc62b 0x316f7e3b 0x316f7ccd 0x316f76df 0x316f74ef 0x316f121d 0x2f22e2a5 0x2f22bc49 0x2f22bf8b 0x2f196f4f 0x2f196d33 0x3409b663 0x31ae216d 0xc91cd 0x39f1cab7) could help to debug but I have no idea what those are.
libc++abi.dylib: terminating with uncaught exception of type NSException
Right now i got another first throw call stack like this 2014-09-19 14:13:19.595[18059:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x05e501e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02c258e5 objc_exception_throw + 44
2 CoreFoundation 0x05e02abc -[__NSArrayM insertObject:atIndex:] + 844
3 CoreFoundation 0x05e02760 -[__NSArrayM addObject:] + 64
4 UIKit 0x012e8050 -[UINavigationBar pushNavigationItem:] + 244
5 UIKit 0x012e73b7 -[UINavigationBar _pushNavigationItem:transition:] + 429
6 UIKit 0x01389fee __71-[UINavigationController pushViewController:transition:forceImmediate:]_block_invoke + 207
7 UIKit 0x01388a2d -[UINavigationController _startDeferredTransitionIfNeeded:] + 998
8 UIKit 0x013894e9 -[UINavigationController __viewWillLayoutSubviews] + 57
9 UIKit 0x014ca0d1 -[UILayoutContainerView layoutSubviews] + 213
10 UIKit 0x11ebd21b -[UILayoutContainerViewAccessibility(SafeCategory) layoutSubviews] + 50
11 UIKit 0x012b1964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
12 libobjc.A.dylib 0x02c3782b -[NSObject performSelector:withObject:] + 70
13 QuartzCore 0x00f3b45a -[CALayer layoutSublayers] + 148
14 QuartzCore 0x00f2f244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
15 QuartzCore 0x00f2f0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
16 QuartzCore 0x00e957fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
17 QuartzCore 0x00e96b85 _ZN2CA11Transaction6commitEv + 393
18 QuartzCore 0x00e97258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
19 CoreFoundation 0x05e1836e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
20 CoreFoundation 0x05e182bf __CFRunLoopDoObservers + 399
21 CoreFoundation 0x05df6254 __CFRunLoopRun + 1076
22 CoreFoundation 0x05df59d3 CFRunLoopRunSpecific + 467
23 CoreFoundation 0x05df57eb CFRunLoopRunInMode + 123
24 GraphicsServices 0x034f95ee GSEventRunModal + 192
25 GraphicsServices 0x034f942b GSEventRun + 104
26 UIKit 0x01242f9b UIApplicationMain + 1225
27 0x0000291d main + 141
28 libdyld.dylib 0x03118701 start + 1
29 ??? 0x00000001 0x0 + 1
)

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