Crashed In NSArray init - ios

I got a crash log described as these:
Exception Type: SIGABRT
Exception Codes: #0 at 0x3b694350
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[124]'
Last Exception Backtrace:
0 CoreFoundation 0x3346e2a3 __exceptionPreprocess (in CoreFoundation) + 163
1 libobjc.A.dylib 0x3b19697f objc_exception_throw (in libobjc.A.dylib) + 31
2 CoreFoundation 0x333b834d -[__NSPlaceholderArray initWithObjects:count:] (in CoreFoundation) + 165
3 CoreFoundation 0x333c6559 +[NSArray arrayWithObjects:count:] (in CoreFoundation) + 45
4 CoreFoundation 0x333d0869 -[NSDictionary allKeys] (in CoreFoundation) + 261
5 SogouInputIPhone.dylib 0x06707df1 0x66e2000 + 155121
6 SogouInputIPhone.dylib 0x066e5533 0x66e2000 + 13619
7 CoreFoundation 0x333bf037 _CFXNotificationPost (in CoreFoundation) + 1427
8 Foundation 0x33cd5599 -[NSNotificationCenter postNotificationName:object:userInfo:] (in Foundation) + 73
9 UIKit 0x35301121 -[UIApplication _handleApplicationSuspend:eventInfo:] (in UIKit) + 817
10 UIKit 0x352771e7 -[UIApplication handleEvent:withNewEvent:] (in UIKit) + 2459
11 UIKit 0x352766cd -[UIApplication sendEvent:] (in UIKit) + 73
12 UIKit 0x3527611b _UIApplicationHandleEvent (in UIKit) + 6155
13 GraphicsServices 0x36f8e5a3 _PurpleEventCallback (in GraphicsServices) + 591
14 GraphicsServices 0x36f8e1d3 PurpleEventCallback (in GraphicsServices) + 35
15 CoreFoundation 0x33443173 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ (in CoreFoundation) + 35
16 CoreFoundation 0x33443117 __CFRunLoopDoSource1 (in CoreFoundation) + 139
17 CoreFoundation 0x33441f99 __CFRunLoopRun (in CoreFoundation) + 1385
18 CoreFoundation 0x333b4ebd CFRunLoopRunSpecific (in CoreFoundation) + 357
19 CoreFoundation 0x333b4d49 CFRunLoopRunInMode (in CoreFoundation) + 105
20 GraphicsServices 0x36f8d2eb GSEventRunModal (in GraphicsServices) + 75
21 UIKit 0x352ca301 UIApplicationMain (in UIKit) + 1121
22 MyApp 0x0000f94b main (in MyApp) (main.m:26)
23 libdyld.dylib 0x3b5cdb20 start (in libdyld.dylib) + 0
I have check my code, no NSArray is used.It seems that the run loop was dispatch the touch event, and generate a NSArray, but I am not sure about it and what let to the crash.

You cannot insert nil into an NSArray, if you want to put a placeholder object into your array you can use [NSNull null]. The solution to your problem is to find the nil object that you're attempting to insert and refrain from inserting it, or alloc/init it and then insert.
If you post the rest of your code we may be able to pinpoint the problem more specifically.

Related

Parse error in existing project

I see this error when I try to initialize parse with app key and client key.
2015-10-08 13:29:56.484 My wish List[7892:4257341] -[ParseManager initWithApplicationId:clientKey:]: unrecognized selector sent to instance 0x7fe86ac35ef0
2015-10-08 13:29:56.491 My wish List[7892:4257341] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ParseManager initWithApplicationId:clientKey:]: unrecognized selector sent to instance 0x7fe86ac35ef0'
*** First throw call stack:
(
0 CoreFoundation 0x00000001045bef65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104038deb objc_exception_throw + 48
2 CoreFoundation 0x00000001045c758d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000104514f7a ___forwarding___ + 970
4 CoreFoundation 0x0000000104514b28 _CF_forwarding_prep_0 + 120
5 My wish List 0x00000001026c7d5f +[Parse setApplicationId:clientKey:] + 212
6 My wish List 0x000000010266d07d -[AppDelegate application:didFinishLaunchingWithOptions:] + 109
7 UIKit 0x00000001049624ca -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
8 UIKit 0x0000000104963670 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
9 UIKit 0x0000000104969e15 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1755
10 UIKit 0x0000000104966ff0 -[UIApplication workspaceDidEndTransaction:] + 188
11 FrontBoardServices 0x000000010c7847ac -[FBSSerialQueue _performNext] + 192
12 FrontBoardServices 0x000000010c784b1a -[FBSSerialQueue _performNextFromRunLoopSource] + 45
13 CoreFoundation 0x00000001044eb0a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x00000001044e0fcc __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x00000001044e0483 __CFRunLoopRun + 867
16 CoreFoundation 0x00000001044dfe98 CFRunLoopRunSpecific + 488
17 UIKit 0x000000010496698d -[UIApplication _run] + 402
18 UIKit 0x000000010496b676 UIApplicationMain + 171
19 My wish List 0x000000010266d30f main + 111
20 libdyld.dylib 0x0000000105f0292d start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Handling Compatibility issues IOS 4.0- 5.1

I have created an app that is running great on 5.0 and above but when I test on devices lower I have ran into a few issues that I am unsure of how to tackle and correct.
The first big issue is when saving to core data I use a error method that I believe is apples default error method that is created when you make a core data model. The app just crashes when below 5.0 but if I block out the error code everything works fine. Below is the code used to find and error and handle it.
NSError *error;
if (![managedObjectContext save:&error]) { // crash here
// This is a serious error saying the record could not be saved.
// Advise the user to restart the application
}
//crash log below
2012-05-13 10:17:22.062 PreviewMaker[41595:207] -[UIImage encodeWithCoder:]:
unrecognized selector sent to instance 0x5e7ce80
2012-05-13 10:17:22.064 PreviewMaker[41595:207] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[UIImage encodeWithCoder:]:
unrecognized selector sent to instance 0x5e7ce80'
*** Call stack at first throw:
(
0 CoreFoundation 0x013fc5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0178b313 objc_exception_throw + 44
2 CoreFoundation 0x013fe0bb -[NSObject(NSObject)
doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0136d966 ___forwarding___ + 966
4 CoreFoundation 0x0136d522 _CF_forwarding_prep_0 + 50
5 Foundation 0x00c45b3e _encodeObject + 1076
6 Foundation 0x00c50f89 +[NSKeyedArchiver
archivedDataWithRootObject:] + 206
7 CoreData 0x01122cb5 -[NSSQLiteConnection execute] +
2677
8 CoreData 0x011771d6 -[NSSQLiteConnection insertRow:]
+ 262
9 CoreData 0x01173e64 -[NSSQLConnection
performAdapterOperations:] + 180
10 CoreData 0x01173b0e -[NSSQLCore
_performChangesWithAdapterOps:] + 494
11 CoreData 0x011725ea -[NSSQLCore performChanges] + 410
12 CoreData 0x0116c038 -[NSSQLCore saveChanges:] + 216
13 CoreData 0x0112a199 -[NSSQLCore
executeRequest:withContext:error:] + 409
14 CoreData 0x011da70b -[NSPersistentStoreCoordinator
executeRequest:withContext:error:] + 3691
15 CoreData 0x01162948 -[NSManagedObjectContext save:] +
712
16 PreviewMaker 0x0000a0c0 -[MainViewController
noUploadJustSaveImage:] + 331
17 PreviewMaker 0x00009d3c -[MainViewController
UserConfirmedToSaveImage] + 756
18 UIKit 0x004774fd -[UIApplication
sendAction:to:from:forEvent:] + 119
19 UIKit 0x00507799 -[UIControl
sendAction:to:forEvent:] + 67
20 UIKit 0x00509c2b -[UIControl(Internal)
_sendActionsForEvents:withEvent:] + 527
21 UIKit 0x005087d8 -[UIControl
touchesEnded:withEvent:] + 458
22 UIKit 0x0049bded -[UIWindow _sendTouchesForEvent:]
+ 567
23 UIKit 0x0047cc37 -[UIApplication sendEvent:] + 447
24 UIKit 0x00481f2e _UIApplicationHandleEvent + 7576
25 GraphicsServices 0x01eb8992 PurpleEventCallback + 1550
26 CoreFoundation 0x013dd944
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
27 CoreFoundation 0x0133dcf7 __CFRunLoopDoSource1 + 215
28 CoreFoundation 0x0133af83 __CFRunLoopRun + 979
29 CoreFoundation 0x0133a840 CFRunLoopRunSpecific + 208
30 CoreFoundation 0x0133a761 CFRunLoopRunInMode + 97
31 GraphicsServices 0x01eb71c4 GSEventRunModal + 217
32 GraphicsServices 0x01eb7289 GSEventRun + 115
33 UIKit 0x00485c93 UIApplicationMain + 1160
34 PreviewMaker 0x00002e07 main + 121
35 PreviewMaker 0x00002d85 start + 53
)
terminate called after throwing an instance of 'NSException'
Another issue I am running into is setting tintColor on UI objects such as the UISwitch. I have a settings controller that has several UISwitches and such which just about all have a tint color set on, but once agin anything below 5.0 crashes. How can I handle the two and not have to re-write the code just to be compatible with devices below 5.0.
shineSwitch = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease];
[cell.contentView addSubview:shineSwitch];
cell.accessoryView = shineSwitch;
[shineSwitch addTarget:self action:#selector(switchChanged:) 
forControlEvents:UIControlEventValueChanged];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
shineSwitch.onTintColor = [UIColor colorWithRed:0.0 green:0.61 blue:0.99 alpha:1.0];
//crash Log below
2012-05-13 10:19:45.033 PreviewMaker[41611:207] -[UISwitch setOnTintColor:]:
unrecognized selector sent to instance 0x5eab860
2012-05-13 10:19:45.034 PreviewMaker[41611:207] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[UISwitch setOnTintColor:]:
unrecognized selector sent to instance 0x5eab860'
*** Call stack at first throw:
(
0 CoreFoundation 0x013fc5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0178b313 objc_exception_throw + 44
2 CoreFoundation 0x013fe0bb -[NSObject(NSObject)
doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0136d966 ___forwarding___ + 966
4 CoreFoundation 0x0136d522 _CF_forwarding_prep_0 + 50
5 PreviewMaker 0x0000f6fb -[FlipsideViewController
tableView:cellForRowAtIndexPath:] + 1353
6 UIKit 0x004ecb98 -
[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634
7 UIKit 0x004e24cc -
[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
8 UIKit 0x004f78cc -
[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
9 UIKit 0x004ef90c -[UITableView layoutSubviews] +
242
10 QuartzCore 0x001e2a5a -[CALayer layoutSublayers] + 181
11 QuartzCore 0x001e4ddc CALayerLayoutIfNeeded + 220
12 QuartzCore 0x0018a0b4
_ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
13 QuartzCore 0x0018b294 _ZN2CA11Transaction6commitEv +
292
14 QuartzCore 0x0018b46d
_ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
15 CoreFoundation 0x013dd89b
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
16 CoreFoundation 0x013726e7 __CFRunLoopDoObservers + 295
17 CoreFoundation 0x0133b1d7 __CFRunLoopRun + 1575
18 CoreFoundation 0x0133a840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x0133a761 CFRunLoopRunInMode + 97
20 GraphicsServices 0x01eb71c4 GSEventRunModal + 217
21 GraphicsServices 0x01eb7289 GSEventRun + 115
22 UIKit 0x00485c93 UIApplicationMain + 1160
23 PreviewMaker 0x00002e07 main + 121
24 PreviewMaker 0x00002d85 start + 53
)
terminate called after throwing an instance of 'NSException'
Any help would be greatly appreciated!

application received SIGABRT and died in ipad but same things runs on simulator fine

my application runs fine in my simulator but whenever i install it in the ipad
it receives SIGABRT and dies
2011-07-05 16:23:59.575 slots2[11008:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableArray insertObject:atIndex:]: attempt to insert nil object at 0'
*** Call stack at first throw:
(
0 CoreFoundation 0x3398964f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x321d5c5d objc_exception_throw + 24
2 CoreFoundation 0x338f1efd -[__NSArrayM insertObject:atIndex:] + 472
3 CoreFoundation 0x338f1d1b -[__NSArrayM addObject:] + 34
4 slots2 0x00005215 -[slots2ViewController viewDidLoad] + 420
5 UIKit 0x3485ef0f -[UIViewController view] + 110
6 slots2 0x00002d31 -[slots2AppDelegate application:didFinishLaunchingWithOptions:] + 92
7 UIKit 0x3485d821 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 772
8 UIKit 0x34857b65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
9 UIKit 0x3482c7d7 -[UIApplication handleEvent:withNewEvent:] + 1114
10 UIKit 0x3482c215 -[UIApplication sendEvent:] + 44
11 UIKit 0x3482bc53 _UIApplicationHandleEvent + 5090
12 GraphicsServices 0x33bcde77 PurpleEventCallback + 666
13 CoreFoundation 0x33960a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
14 CoreFoundation 0x3396283f __CFRunLoopDoSource1 + 166
15 CoreFoundation 0x3396360d __CFRunLoopRun + 520
16 CoreFoundation 0x338f3ec3 CFRunLoopRunSpecific + 230
17 CoreFoundation 0x338f3dcb CFRunLoopRunInMode + 58
18 UIKit 0x34856d49 -[UIApplication _run] + 372
19 UIKit 0x34854807 UIApplicationMain + 670
20 slots2 0x00002c91 main + 88
21 slots2 0x00002c34 start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.1 (8G4)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
(gdb)
but i m sure all files are there cuz same thing runs in simulator
the follwing array is the array which may be the problem
NSString *SubDir = [NSString stringWithFormat:#"/R/%d",Theme];
for(int i = 0;i<11;i++)
[SpinAnimationArray addObject:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:#"blur%d",i] ofType:#"png" inDirectory:SubDir]]];
in slots2ViewController viewDidLoad
u have an array and u were trying to add object which has wrong index.
and checkout
blur0 - blur10 png is copied and existing in ur target

How to understand and fixed this error?

2011-04-20 18:38:41.347 RIE[1683:607] -[UICGColor _shouldContinuePlaybackInBackground]: unrecognized selector sent to instance 0x28db10
2011-04-20 18:38:41.417 RIE[1683:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICGColor _shouldContinuePlaybackInBackground]: unrecognized selector sent to instance 0x28db10'
*** Call stack at first throw:
(
0 CoreFoundation 0x342ed64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x35570c5d objc_exception_throw + 24
2 CoreFoundation 0x342f11bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x342f0649 ___forwarding___ + 508
4 CoreFoundation 0x34267180 _CF_forwarding_prep_0 + 48
5 MediaPlayer 0x344628b7 -[MPMoviePlayerViewController _moviePlayerViewController_applicationDidEnterBackgroundNotification:] + 42
6 Foundation 0x333b5183 _nsnote_callback + 142
7 CoreFoundation 0x342bc20f __CFXNotificationPost_old + 402
8 CoreFoundation 0x34256eeb _CFXNotificationPostNotification + 118
9 Foundation 0x333b25d3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
10 UIKit 0x36364d01 -[UIApplication _handleApplicationSuspend:eventInfo:] + 500
11 UIKit 0x362feaf9 -[UIApplication handleEvent:withNewEvent:] + 1916
12 UIKit 0x362fe215 -[UIApplication sendEvent:] + 44
13 UIKit 0x362fdc53 _UIApplicationHandleEvent + 5090
14 GraphicsServices 0x33e58e77 PurpleEventCallback + 666
15 CoreFoundation 0x342c4a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
16 CoreFoundation 0x342c683f __CFRunLoopDoSource1 + 166
17 CoreFoundation 0x342c760d __CFRunLoopRun + 520
18 CoreFoundation 0x34257ec3 CFRunLoopRunSpecific + 230
19 CoreFoundation 0x34257dcb CFRunLoopRunInMode + 58
20 GraphicsServices 0x33e5841f GSEventRunModal + 114
21 GraphicsServices 0x33e584cb GSEventRun + 62
22 UIKit 0x36328d69 -[UIApplication _run] + 404
23 UIKit 0x36326807 UIApplicationMain + 670
24 Motor Show 0x0000219b main + 70
25 Motor Show 0x00002150 start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
Hard to say given just the stack trace, but I would suggest the following:
Implement applicationWillResignActive: in your UIApplicationDelegate to ensure that video playback is paused or stopped before the application enters the background.
Create a custom UIApplication subclass to use in your app, and override the _handleApplicationSuspend:eventInfo: method so that it returns without propagating the event to other classes further down the chain.
Figure out how to unregister your MPMoviePlayerViewController component from the notification center so that it does not receive the 'ApplicationDidEnterBackgroundNotification'.

Strange Modal View Controller NSException bug

Can anyone help me make sense of the crash log below? It came from Apple after inquiring further about a crash my app had. They rejected the app because of this crash, but I have never once been able to make it occur on my end or with 10+ beta testers. So basically, it is only occurring for them for some reason. It looks like it has to do with presenting a view, but that's weird because, like I said, this view is coming up perfectly fine.
Mar 11 14:46:09 unknown StageBloc[2309] <Error>: *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[AccountOverviewViewController popupViewController]: unrecognized selector sent to instance 0x2c7820'
*** Call stack at first throw:
(
0 CoreFoundation 0x3291964f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x36b5cc5d objc_exception_throw + 24
2 CoreFoundation 0x3291d1bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x3291c649 ___forwarding___ + 508
4 CoreFoundation 0x32893180 _CF_forwarding_prep_0 + 48
5 AppName 0x0004b56d -[TTBaseViewController shouldAutorotateToInterfaceOrientation:] + 36
6 UIKit 0x35b0dead -[UIViewController _isSupportedInterfaceOrientation:] + 48
7 UIKit 0x35b76e51 -[UIViewController _preferredInterfaceOrientationGivenCurrentOrientation:] + 68
8 UIKit 0x35b75f07 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 794
9 UIKit 0x35b756f7 -[UIViewController presentModalViewController:withTransition:] + 2378
10 UIKit 0x35b74cd7 -[UIViewController presentModalViewController:animated:] + 58
11 StageBloc 0x00009bb1 -[StageBlocViewController loginSuccessful] + 196
12 StageBloc 0x00004c21 -[StageBlocAppDelegate successfulAttempt:] + 288
13 CoreFoundation 0x32886f03 -[NSObject(NSObject) performSelector:withObject:] + 22
14 AppName 0x0002aa75 -[ASIHTTPRequest reportFinished] + 60
15 CoreFoundation 0x32886f03 -[NSObject(NSObject) performSelector:withObject:] + 22
16 Foundation 0x325707a9 __NSThreadPerformPerform + 268
17 CoreFoundation 0x328f0a79 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
18 CoreFoundation 0x328f275f __CFRunLoopDoSources0 + 382
19 CoreFoundation 0x328f34eb __CFRunLoopRun + 230
20 CoreFoundation 0x32883ec3 CFRunLoopRunSpecific + 230
21 CoreFoundation 0x32883dcb CFRunLoopRunInMode + 58
22 GraphicsServices 0x30b2b41f GSEventRunModal + 114
23 GraphicsServices 0x30b2b4cb GSEventRun + 62
24 UIKit 0x35af9d69 -[UIApplication _run] + 404
25 UIKit 0x35af7807 UIApplicationMain + 670
26 AppName 0x00002ae1 main + 48
27 AppName 0x00002aac start + 40
)
This had to do with forgetting to add some required built variables to my project that the Three20 libraries use. I didn't notice it because you can't run App Store release builds locally.

Resources