iOS App Crash on startup - iphone

The latest version of my app has started to crash on startup for some users. There is only 1 crash report in itunes which is included below. I have been unable to reproduce on any devices.
The changes between the two version are
Integrated two third party libraries (iNotify, openUDID)
Switched from the GCC compiler to the Apple LLVM 3.1 compiler (new libraries need arc support)
Compiled the new libraries's code with arc enabled, left arc disabled for the rest of the project.
I added 1 line to the didFinishLaunchingWithOptions in my appdelegate for iNotify. From the stack trace through I do not think its crashing in there.
At a bit of a loss where to go with this. Any help would be appreciated. Thanks!
Hardware Model: iPhone4,1
Process: MyAPP [3251]
Path: /var/mobile/Applications/228BBF42-A374-4773-8C18-EFA47CE98C02/MyAPP.app/MyAPP
Identifier: MyAPP
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2012-05-03 19:50:07.917 -0500
OS Version: iPhone OS 5.1 (9B179)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x3729e88f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x357a4259 objc_exception_throw + 33
2 CoreFoundation 0x372a1a9b -[NSObject doesNotRecognizeSelector:] + 175
3 CoreFoundation 0x372a0915 ___forwarding___ + 301
4 CoreFoundation 0x371fb650 _CF_forwarding_prep_0 + 48
5 UIKit 0x33aa9f93 -[UIAlertView(Private) _popoutAnimationDidStop:finished:] + 855
6 UIKit 0x3395fc53 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 471
7 UIKit 0x3396557d -[UIViewAnimationState animationDidStop:finished:] + 53
8 QuartzCore 0x341fbc2f CA::Layer::run_animation_callbacks(void*) + 203
9 libdispatch.dylib 0x344f6ee7 _dispatch_main_queue_callback_4CF$VARIANT$mp + 195
10 CoreFoundation 0x372712ad __CFRunLoopRun + 1269
11 CoreFoundation 0x371f44a5 CFRunLoopRunSpecific + 301
12 CoreFoundation 0x371f436d CFRunLoopRunInMode + 105
13 GraphicsServices 0x32101439 GSEventRunModal + 137
14 UIKit 0x33978e7d UIApplicationMain + 1081
15 MyAPP 0x00002bfb main (main.m:14)
16 MyAPP 0x00002bb4 0x00002bb4
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3571d32c __pthread_kill + 8
1 libsystem_c.dylib 0x3186b208 pthread_kill + 48
2 libsystem_c.dylib 0x31864298 abort + 88
3 libc++abi.dylib 0x34e70f64 abort_message + 40
4 libc++abi.dylib 0x34e6e346 _ZL17default_terminatev + 18
5 libobjc.A.dylib 0x357a4350 _objc_terminate + 140
6 libc++abi.dylib 0x34e6e3be _ZL19safe_handler_callerPFvvE + 70
7 libc++abi.dylib 0x34e6e44a std::terminate() + 14
8 libc++abi.dylib 0x34e6f81e __cxa_rethrow + 82
9 libobjc.A.dylib 0x357a42a2 objc_exception_rethrow + 6
10 CoreFoundation 0x371f4506 CFRunLoopRunSpecific + 398
11 CoreFoundation 0x371f4366 CFRunLoopRunInMode + 98
12 GraphicsServices 0x32101432 GSEventRunModal + 130
13 UIKit 0x33978e76 UIApplicationMain + 1074
14 MyAPP 0x00002bf4 main (main.m:14)
15 MyAPP 0x00002bac 0x00002bac
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3570d3a8 kevent + 24
1 libdispatch.dylib 0x344f7f04 _dispatch_mgr_invoke + 708
2 libdispatch.dylib 0x344f7c22 _dispatch_mgr_thread + 30
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x3570d004 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3570d1fa mach_msg + 50
2 CoreFoundation 0x372723ec __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x37271124 __CFRunLoopRun + 876
4 CoreFoundation 0x371f449e CFRunLoopRunSpecific + 294
5 CoreFoundation 0x371f4366 CFRunLoopRunInMode + 98
6 WebCore 0x32eb40f0 _ZL12RunWebThreadPv + 396
7 libsystem_c.dylib 0x3182c72e _pthread_start + 314
8 libsystem_c.dylib 0x3182c5e8 thread_start + 0
Thread 3:
0 libsystem_kernel.dylib 0x3571dcd4 __workq_kernreturn + 8
1 libsystem_c.dylib 0x31826f36 _pthread_wqthread + 610
2 libsystem_c.dylib 0x31826cc8 start_wqthread + 0
Thread 4 name: com.apple.CFSocket.private
Thread 4:
0 libsystem_kernel.dylib 0x3571d570 __select + 20
1 CoreFoundation 0x3727663a __CFSocketManager + 726
2 libsystem_c.dylib 0x3182c72e _pthread_start + 314
3 libsystem_c.dylib 0x3182c5e8 thread_start + 0
Thread 5:
0 libsystem_kernel.dylib 0x3571dcd4 __workq_kernreturn + 8
1 libsystem_c.dylib 0x31826f36 _pthread_wqthread + 610
2 libsystem_c.dylib 0x31826cc8 start_wqthread + 0
Some additional code.
There is an alertview defined in the appdelegate as follows:
#import <UIKit/UIKit.h>
#class MyAPPViewController;
#interface MyAPPAppDelegate : NSObject <UIApplicationDelegate> {
UIViewController *rvc;
UIAlertView *m_cAlertControl;
}
#property (nonatomic, retain) IBOutlet UIWindow *window;
-(BOOL)shouldNag;
-(void)shouldEnableUI:(BOOL)pIsEnable;
-(void)updateRunCount;
#end
and a method implemented in the app delegate as follows:
-(void)shouldEnableUI:(BOOL)pIsEnable
{
if(NO == pIsEnable)
{
if (nil == m_cAlertControl) {
m_cAlertControl = [[UIAlertView alloc] init];
}
m_cAlertControl.backgroundColor = [UIColor clearColor];
m_cAlertControl.opaque = NO;
[m_cAlertControl setHidden:YES];
[m_cAlertControl show];
}
else {
if (nil != m_cAlertControl) {
[m_cAlertControl dismissWithClickedButtonIndex:0 animated:YES];
}
}
}
The View controller's make calls to the method like this:
[appDelegate shouldEnableUI:NO];

On seeing crash logs issue seems like call has been made to UIAlertViewDelegate after it has been released.
You need to release that in the controller where you are using alert -
-(void)dealloc {
self.alertView.delegate = nil; //setting delegate to nil
self.alertView = nil; //if you have defined alert as property
//other release statements of your controller
[super dealloc];
}
You can add some code of your app if you want some other information, or this is not the case with your app.
EDIT 1 -
-(void)dealloc {
m_cAlertControl.delegate = nil; //setting delegate to nil
[m_cAlertControl release];
//other release statements of your controller
[super dealloc];
}

I would say that this is the biggest pointer you have
[NSObject doesNotRecognizeSelector:] + 175
Looks like you have a missing selector method somewhere.

Related

something strange when core data function [duplicate]

This question already has answers here:
Core Data causing app to crash while migrating
(1 answer)
Why is App crashing when loading a pre populated DB into Core Data upon first open on Older Devices?
(1 answer)
Closed 9 years ago.
In my project, sometimes when call - (void)saveContext, the app crash, keep the screen locked, nothing could be done.
I found that in function - (void)saveContext below
- (void)saveContext
{
NSError *error = nil;
NSManagedObjectContext *managedObjectContext = _dataController.managedObjectContext;
if (managedObjectContext != nil) {
if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(#"Unresolved error %#, %#", error, [error userInfo]);
abort();
}
else {
NSLog(#"save successful?");
}
}
if (error != nil) {
NSLog(#"Unresolved error %#, %#", error, [error userInfo]);
}
}
there is no output message. Core data's save function did not success and no failed error.
Why did that happen?Could somebody help me? Thanks!
crash report
Date/Time: 2013-10-03 18:05:31.016 +0800
OS Version: iOS 6.1.3 (10B329)
Report Version: 104
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Elapsed total CPU time (seconds): 11.020 (user 11.020, system 0.000), 55% CPU
Elapsed application CPU time (seconds): 9.389, 47% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libobjc.A.dylib 0x3b8745ac objc_msgSend + 12
1 CoreData 0x337f6bf4 -[NSSQLCore createAdapterOperationsForDatabaseOperation:] + 232
2 CoreData 0x337f88c0 -[NSSQLCore performChanges] + 184
3 CoreData 0x337f9a56 -[NSSQLCore saveChanges:] + 630
4 CoreData 0x3376022a -[NSSQLCore executeRequest:withContext:error:] + 506
5 CoreData 0x3375f4c4 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1300
6 CoreData 0x337b76de -[NSManagedObjectContext save:] + 726
7 LFeCatalogue 0x000ff130 -[AppDelegate saveContext] (AppDelegate.m:329)
8 LFeCatalogue 0x00152432 -[ECatalogueDataController alertView:clickedButtonAtIndex:] (ECatalogueDataController.m:2316)
9 UIKit 0x3591dc4c -[UIAlertView(Private) _buttonClicked:] + 292
10 UIKit 0x358b10c0 -[UIApplication sendAction:to:from:forEvent:] + 68
11 UIKit 0x358b1072 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26
12 UIKit 0x358b1050 -[UIControl sendAction:to:forEvent:] + 40
13 UIKit 0x358b0906 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 498
14 UIKit 0x358b0dfc -[UIControl touchesEnded:withEvent:] + 484
15 UIKit 0x357d95ec -[UIWindow _sendTouchesForEvent:] + 520
16 UIKit 0x357c67fc -[UIApplication sendEvent:] + 376
17 UIKit 0x357c6116 _UIApplicationHandleEvent + 6150
18 GraphicsServices 0x374d15a0 _PurpleEventCallback + 588
19 GraphicsServices 0x374d11ce PurpleEventCallback + 30
20 CoreFoundation 0x33993170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
21 CoreFoundation 0x33993112 __CFRunLoopDoSource1 + 134
22 CoreFoundation 0x33991f94 __CFRunLoopRun + 1380
23 CoreFoundation 0x33904eb8 CFRunLoopRunSpecific + 352
24 CoreFoundation 0x33904d44 CFRunLoopRunInMode + 100
25 GraphicsServices 0x374d02e6 GSEventRunModal + 70
26 UIKit 0x3581a2fc UIApplicationMain + 1116
27 LFeCatalogue 0x000fdc72 main (main.m:16)
28 libdyld.dylib 0x3bcb0b1c start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3bd67648 kevent64 + 24
1 libdispatch.dylib 0x3bc97974 _dispatch_mgr_invoke + 792
2 libdispatch.dylib 0x3bc97654 _dispatch_mgr_thread$VARIANT$mp + 32
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x3bd66eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3bd67048 mach_msg + 36
2 CoreFoundation 0x33993040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x33991d9e __CFRunLoopRun + 878
4 CoreFoundation 0x33904eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x33904d44 CFRunLoopRunInMode + 100
6 WebCore 0x3990b500 _ZL12RunWebThreadPv + 440
7 libsystem_c.dylib 0x3bcd030e _pthread_start + 306
8 libsystem_c.dylib 0x3bcd01d4 thread_start + 4
Thread 3 name: com.apple.NSURLConnectionLoader
Thread 3:
0 libsystem_kernel.dylib 0x3bd66eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3bd67048 mach_msg + 36
2 CoreFoundation 0x33993040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x33991d9e __CFRunLoopRun + 878
4 CoreFoundation 0x33904eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x33904d44 CFRunLoopRunInMode + 100
6 Foundation 0x342513d0 +[NSURLConnection(Loader) _resourceLoadLoop:] + 304
7 Foundation 0x342d4e80 __NSThread__main__ + 968
8 libsystem_c.dylib 0x3bcd030e _pthread_start + 306
9 libsystem_c.dylib 0x3bcd01d4 thread_start + 4
Thread 4 name: com.apple.CFSocket.private
Thread 4:
0 libsystem_kernel.dylib 0x3bd77594 __select + 20
1 CoreFoundation 0x339971f2 __CFSocketManager + 674
2 libsystem_c.dylib 0x3bcd030e _pthread_start + 306
3 libsystem_c.dylib 0x3bcd01d4 thread_start + 4
Thread 5:
0 libsystem_kernel.dylib 0x3bd77d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x3bcc5cf6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x3bcc5a12 _pthread_wqthread + 362
3 libsystem_c.dylib 0x3bcc58a0 start_wqthread + 4
Thread 6:
0 libsystem_kernel.dylib 0x3bd77d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x3bcc5cf6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x3bcc5a12 _pthread_wqthread + 362
3 libsystem_c.dylib 0x3bcc58a0 start_wqthread + 4
Unknown thread crashed with unknown flavor: 5, state_count: 1

App crashes on iPhone 5 with iOS 6

The resolution center rejected my app because, as they say, it crashes on iPhone 5 with iOS 6.1.2.
I have an iPhone 4 with iOS 6.1.2 and it doesnt crash. I can't solve that problem!
They also wrote that the app crash when:
Launch the app
Login with Facebook.
App crashes when the device returns to the app.
Here the simbolicated crash log:
Last Exception Backtrace:
0 CoreFoundation 0x344ec3e2 0x3442a000 + 795618
1 libobjc.A.dylib 0x3c1dd95e 0x3c1d5000 + 35166
2 CoreFoundation 0x344eff2c 0x3442a000 + 810796
3 CoreFoundation 0x344ee648 0x3442a000 + 804424
4 CoreFoundation 0x34446204 0x3442a000 + 115204
5 Kick - Serie A 0x0007252c -[LetturaScrittura writeStringToFile:] (LetturaScrittura.m:26)
6 Kick - Serie A 0x0006e9da __25-[Profilo carica_profilo]_block_invoke (Profilo.m:314)
7 Kick - Serie A 0x0007e14a -[FBRequestConnection completeWithResults:orError:] (FBRequestConnection.m:1200)
8 Kick - Serie A 0x0007d56c -[FBRequestConnection completeWithResponse:data:orError:] (FBRequestConnection.m:983)
9 Kick - Serie A 0x0007b6aa __68-[FBRequestConnection startWithCacheIdentity:skipRoundtripIfCached:]_block_invoke_0 (FBRequestConnection.m:499)
10 Kick - Serie A 0x0007f38e -[FBURLConnection invokeHandler:error:response:responseData:] (FBURLConnection.m:163)
11 Kick - Serie A 0x0007f8f4 -[FBURLConnection connectionDidFinishLoading:] (FBURLConnection.m:233)
12 Foundation 0x34e28910 0x34d53000 + 874768
13 Foundation 0x34d68764 0x34d53000 + 87908
14 Foundation 0x34d68680 0x34d53000 + 87680
15 CFNetwork 0x341c964a 0x34141000 + 558666
16 CFNetwork 0x341c8d2e 0x34141000 + 556334
17 CFNetwork 0x341f100e 0x34141000 + 720910
18 CoreFoundation 0x34432ac8 0x3442a000 + 35528
19 CFNetwork 0x341f146e 0x34141000 + 722030
20 CFNetwork 0x3415545c 0x34141000 + 83036
21 CoreFoundation 0x344c18f2 0x3442a000 + 620786
22 CoreFoundation 0x344c1158 0x3442a000 + 618840
23 CoreFoundation 0x344bff2a 0x3442a000 + 614186
24 CoreFoundation 0x34433238 0x3442a000 + 37432
25 CoreFoundation 0x344330c4 0x3442a000 + 37060
26 GraphicsServices 0x38011336 0x3800c000 + 21302
27 UIKit 0x3634f2b4 0x362f8000 + 357044
28 Kick - Serie A 0x0006ac92 main (main.m:16)
29 libdyld.dylib 0x3c60ab1c 0x3c609000 + 6940
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3c6d1350 __pthread_kill + 8
1 libsystem_c.dylib 0x3c647fb2 pthread_kill + 54
2 libsystem_c.dylib 0x3c684366 abort + 90
3 libc++abi.dylib 0x3bc2cdda abort_message + 70
4 libc++abi.dylib 0x3bc2a094 default_terminate() + 20
5 libobjc.A.dylib 0x3c1dda58 _objc_terminate() + 144
6 libc++abi.dylib 0x3bc2a118 safe_handler_caller(void (*)()) + 76
7 libc++abi.dylib 0x3bc2a1b0 std::terminate() + 16
8 libc++abi.dylib 0x3bc2b626 __cxa_rethrow + 90
9 libobjc.A.dylib 0x3c1dd9b0 objc_exception_rethrow + 8
10 CoreFoundation 0x3443329c CFRunLoopRunSpecific + 452
11 CoreFoundation 0x344330c4 CFRunLoopRunInMode + 100
12 GraphicsServices 0x38011336 GSEventRunModal + 70
13 UIKit 0x3634f2b4 UIApplicationMain + 1116
14 Kick - Serie A 0x0006ac92 main (main.m:16)
15 libdyld.dylib 0x3c60ab1c start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3c6c15d0 kevent64 + 24
1 libdispatch.dylib 0x3c5fcd22 _dispatch_mgr_invoke + 806
2 libdispatch.dylib 0x3c5f8374 _dispatch_mgr_thread + 32
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x3c6c0e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3c6c0fd0 mach_msg + 48
2 CoreFoundation 0x344c12b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x344c002c __CFRunLoopRun + 900
4 CoreFoundation 0x34433238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x344330c4 CFRunLoopRunInMode + 100
6 WebCore 0x3a432390 RunWebThread(void*) + 440
7 libsystem_c.dylib 0x3c62a0de _pthread_start + 306
8 libsystem_c.dylib 0x3c629fa4 thread_start + 4
Thread 3 name: com.apple.NSURLConnectionLoader
Thread 3:
0 libsystem_kernel.dylib 0x3c6c0e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3c6c0fd0 mach_msg + 48
2 CoreFoundation 0x344c12b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x344c002c __CFRunLoopRun + 900
4 CoreFoundation 0x34433238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x344330c4 CFRunLoopRunInMode + 100
6 Foundation 0x34d80888 +[NSURLConnection(Loader) _resourceLoadLoop:] + 304
7 Foundation 0x34e0422c __NSThread__main__ + 968
8 libsystem_c.dylib 0x3c62a0de _pthread_start + 306
9 libsystem_c.dylib 0x3c629fa4 thread_start + 4
Thread 4 name: com.apple.CFSocket.private
Thread 4:
0 libsystem_kernel.dylib 0x3c6d1594 __select + 20
1 CoreFoundation 0x344c5474 __CFSocketManager + 676
2 libsystem_c.dylib 0x3c62a0de _pthread_start + 306
3 libsystem_c.dylib 0x3c629fa4 thread_start + 4
Thread 5:
0 libsystem_kernel.dylib 0x3c6d1d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x3c61fad6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x3c61f7f2 _pthread_wqthread + 362
3 libsystem_c.dylib 0x3c61f680 start_wqthread + 4
Thread 6:
0 libsystem_kernel.dylib 0x3c6d1d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x3c61fad6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x3c61f7f2 _pthread_wqthread + 362
3 libsystem_c.dylib 0x3c61f680 start_wqthread + 4
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x3e191524
r4: 0x00000006 r5: 0x3e191b78 r6: 0x1dd85ca4 r7: 0x2fd979f4
r8: 0x1dd85c80 r9: 0x00000300 r10: 0x00000000 r11: 0x3455b022
ip: 0x00000148 sp: 0x2fd979e8 lr: 0x3c647fb7 pc: 0x3c6d1350
cpsr: 0x00000010
Here's the LetturaScrittore method that makes the app crash (I use it to write on a .txt the email of the facebook user):
- (void)writeStringToFile:(NSString*)aString {
// Build the path, and create if needed.
NSString* filePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString* fileName = #"myTextFile.txt";
NSString* fileAtPath = [filePath stringByAppendingPathComponent:fileName];
if (![[NSFileManager defaultManager] fileExistsAtPath:fileAtPath]) {
[[NSFileManager defaultManager] createFileAtPath:fileAtPath contents:nil attributes:nil];
}
// The main act.
[[aString dataUsingEncoding:NSUTF8StringEncoding] writeToFile:fileAtPath atomically:YES];
}
The reason for the crash is that you don't actually pass a NSString object to writeStringToFile.
My mistake was on the facebook auth login: without the permission of the email, facebook return nothing, and the app crashes when trying to write the .txt file.

UITableView crash when selecting

I have a simple table view controller driven by the fetchedResultsController and it crashes very often when I select it and the crash log is like this;
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xc21eb7ad
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3c0ce5d0 objc_msgSend + 16
1 UIKit 0x3623c564 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 404
2 UIKit 0x3622138c -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1312
3 UIKit 0x36238822 -[UITableView layoutSubviews] + 202
4 UIKit 0x361f48c2 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 254
5 QuartzCore 0x35fa050e -[CALayer layoutSublayers] + 210
6 QuartzCore 0x35fa00b0 CA::Layer::layout_if_needed(CA::Transaction*) + 456
7 QuartzCore 0x35fa0fd4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 12
8 QuartzCore 0x35fa09be CA::Context::commit_transaction(CA::Transaction*) + 234
9 QuartzCore 0x35fa07d0 CA::Transaction::commit() + 312
10 QuartzCore 0x35fa0634 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
11 CoreFoundation 0x343b793e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
12 CoreFoundation 0x343b5c34 __CFRunLoopDoObservers + 272
13 CoreFoundation 0x343b5f8e __CFRunLoopRun + 742
14 CoreFoundation 0x34329238 CFRunLoopRunSpecific + 352
15 CoreFoundation 0x343290c4 CFRunLoopRunInMode + 100
16 GraphicsServices 0x37f07336 GSEventRunModal + 70
17 UIKit 0x362452b4 UIApplicationMain + 1116
18 Introdex 0x0011e538 0xa3000 + 505144
19 Introdex 0x000a5a24 0xa3000 + 10788
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3c5b75d0 kevent64 + 24
1 libdispatch.dylib 0x3c4f2d22 _dispatch_mgr_invoke + 806
2 libdispatch.dylib 0x3c4ee374 _dispatch_mgr_thread + 32
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x3c5b6e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3c5b6fd0 mach_msg + 48
2 CoreFoundation 0x343b72b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x343b602c __CFRunLoopRun + 900
4 CoreFoundation 0x34329238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x343290c4 CFRunLoopRunInMode + 100
6 WebCore 0x3a328390 RunWebThread(void*) + 440
7 libsystem_c.dylib 0x3c5200de _pthread_start + 306
8 libsystem_c.dylib 0x3c51ffa4 thread_start + 4
Thread 3:
0 libsystem_kernel.dylib 0x3c5b6e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3c5b6fd0 mach_msg + 48
2 CoreFoundation 0x343b72b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x343b602c __CFRunLoopRun + 900
4 CoreFoundation 0x34329238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x343290c4 CFRunLoopRunInMode + 100
6 Foundation 0x34c4d5be -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7 Foundation 0x34cf0c40 -[NSRunLoop(NSRunLoop) run] + 76
8 Introdex 0x0021924c 0xa3000 + 1532492
9 Foundation 0x34cfa22c __NSThread__main__ + 968
10 libsystem_c.dylib 0x3c5200de _pthread_start + 306
11 libsystem_c.dylib 0x3c51ffa4 thread_start + 4
Thread 4 name: com.apple.NSURLConnectionLoader
Thread 4:
0 libsystem_kernel.dylib 0x3c5b6e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3c5b6fd0 mach_msg + 48
2 CoreFoundation 0x343b72b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x343b602c __CFRunLoopRun + 900
4 CoreFoundation 0x34329238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x343290c4 CFRunLoopRunInMode + 100
6 Foundation 0x34c76888 +[NSURLConnection(Loader) _resourceLoadLoop:] + 304
7 Foundation 0x34cfa22c __NSThread__main__ + 968
8 libsystem_c.dylib 0x3c5200de _pthread_start + 306
9 libsystem_c.dylib 0x3c51ffa4 thread_start + 4
Thread 5 name: com.apple.CFSocket.private
Thread 5:
0 libsystem_kernel.dylib 0x3c5c7594 __select + 20
1 CoreFoundation 0x343bb474 __CFSocketManager + 676
2 libsystem_c.dylib 0x3c5200de _pthread_start + 306
3 libsystem_c.dylib 0x3c51ffa4 thread_start + 4
Thread 6 name: JavaScriptCore::BlockFree
Thread 6:
0 libsystem_kernel.dylib 0x3c5c708c __psynch_cvwait + 24
1 libsystem_c.dylib 0x3c518afc _pthread_cond_wait + 644
2 libsystem_c.dylib 0x3c518870 pthread_cond_timedwait + 40
3 JavaScriptCore 0x382fddf6 WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 102
4 JavaScriptCore 0x38410532 JSC::BlockAllocator::blockFreeingThreadMain() + 78
5 JavaScriptCore 0x38423030 WTF::wtfThreadEntryPoint(void*) + 12
6 libsystem_c.dylib 0x3c5200de _pthread_start + 306
7 libsystem_c.dylib 0x3c51ffa4 thread_start + 4
Thread 7 name: JavaScriptCore::Marking
Thread 7:
0 libsystem_kernel.dylib 0x3c5c708c __psynch_cvwait + 24
1 libsystem_c.dylib 0x3c518afc _pthread_cond_wait + 644
2 libsystem_c.dylib 0x3c522cf8 pthread_cond_wait + 36
3 JavaScriptCore 0x383a36dc JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode) + 140
4 JavaScriptCore 0x383a3620 JSC::MarkStackThreadSharedData::markingThreadMain() + 140
5 JavaScriptCore 0x38423030 WTF::wtfThreadEntryPoint(void*) + 12
6 libsystem_c.dylib 0x3c5200de _pthread_start + 306
7 libsystem_c.dylib
Can somebody please explain me what this crash log means. I could not read it properly and do not know what this actually means. It would be really great if anyone could help me.
Without looking at your code, its hard to know where you going wrong.
But still as I know If you are able show the data on Table successfully and getting crash while click on particular row.
Below are some possibilities.
1). make sure you have declared UITableViewDelegate in your controller's header file.
Solution : make sure you have this (in .h file)
#interface FavViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>
2). forgot to hook-up delegate with File owner
Solution : Open Layout's XIB file --> select UITableView --> in Connection Inspector --> drag delegate to the File's Owner (as per the below image)
you can achieve same by doing it programmatically in your .m file's viewDidLoad method
favourite_tbl.delegate=self;//favourite_tbl is instance of myTableView
3). your didSelectRowAtIndexPath method (for click on row) should be like
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
selectedIndex = indexPath.row;
NSLog(#"you have selected %d",selectedIndex);
}
Feel free to drop me a comment if you have any trouble in this.

how to debug EXC_CRASH (SIGTRAP)

i'm running my app are running fine until i resume from background or with out location services, the app will crash.
the crash log shows Exception Type: EXC_CRASH (SIGTRAP)
Anybody know how to debug it ?
Exception Type: EXC_CRASH (SIGTRAP)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x36398848 __kill + 8
1 FrogFinder 0x000b5034 0x69000 + 311348
2 CoreFoundation 0x3447e980 __handleUncaughtException + 68
3 libobjc.A.dylib 0x346ce2ca _objc_terminate + 122
4 libc++abi.dylib 0x338a33be _ZL19safe_handler_callerPFvvE + 70
5 libc++abi.dylib 0x338a344a std::terminate() + 14
6 libc++abi.dylib 0x338a481e __cxa_rethrow + 82
7 libobjc.A.dylib 0x346ce22e objc_exception_rethrow + 6
8 CoreFoundation 0x343d453e CFRunLoopRunSpecific + 398
9 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
10 GraphicsServices 0x30c58fc6 GSEventRunModal + 150
11 UIKit 0x3785573c UIApplicationMain + 1084
12 FrogFinder 0x0006a7e6 0x69000 + 6118
13 FrogFinder 0x0006a7a4 0x69000 + 6052
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x363893b4 kevent + 24
1 libdispatch.dylib 0x370b3e78 _dispatch_mgr_invoke + 708
2 libdispatch.dylib 0x370b3b96 _dispatch_mgr_thread + 30
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x36389010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x36389206 mach_msg + 50
2 CoreFoundation 0x3445241c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x34451154 __CFRunLoopRun + 876
4 CoreFoundation 0x343d44d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
6 WebCore 0x368a8128 _ZL12RunWebThreadPv + 396
7 libsystem_c.dylib 0x33224c16 _pthread_start + 314
8 libsystem_c.dylib 0x33224ad0 thread_start + 0
Thread 3 name: com.apple.NSURLConnectionLoader
Thread 3:
0 libsystem_kernel.dylib 0x36389010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x36389206 mach_msg + 50
2 CoreFoundation 0x3445241c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x34451154 __CFRunLoopRun + 876
4 CoreFoundation 0x343d44d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
6 Foundation 0x35dd4bc2 +[NSURLConnection(Loader) _resourceLoadLoop:] + 302
7 Foundation 0x35dd4a8a -[NSThread main] + 66
8 Foundation 0x35e6859a __NSThread__main__ + 1042
9 libsystem_c.dylib 0x33224c16 _pthread_start + 314
10 libsystem_c.dylib 0x33224ad0 thread_start + 0
Thread 4:
0 libsystem_kernel.dylib 0x36389010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x36389206 mach_msg + 50
2 CoreFoundation 0x3445241c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x34451154 __CFRunLoopRun + 876
4 CoreFoundation 0x343d44d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
6 Foundation 0x35dc8b7e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7 Foundation 0x35de252c -[NSRunLoop(NSRunLoop) run] + 72
8 FrogFinder 0x000c8da6 0x69000 + 392614
9 Foundation 0x35dd4a8a -[NSThread main] + 66
10 Foundation 0x35e6859a __NSThread__main__ + 1042
11 libsystem_c.dylib 0x33224c16 _pthread_start + 314
12 libsystem_c.dylib 0x33224ad0 thread_start + 0
Thread 5 name: NetworkIO
Thread 5:
0 libsystem_kernel.dylib 0x36389010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x36389206 mach_msg + 50
2 CoreFoundation 0x3445241c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x34451154 __CFRunLoopRun + 876
4 CoreFoundation 0x343d44d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
6 MapKit 0x38030412 0x38022000 + 58386
7 Foundation 0x35dd4a8a -[NSThread main] + 66
8 Foundation 0x35e6859a __NSThread__main__ + 1042
9 libsystem_c.dylib 0x33224c16 _pthread_start + 314
10 libsystem_c.dylib 0x33224ad0 thread_start + 0
You can also turn on Exception breakpoints. In XCode 4 click your project and choose the breakpoints tab. At the bottom of that tab is | + | - | search bar. Choose the + item and "Add Exeception Breakpoint". You can leave it at All or choose Objective-C. This way you will break in the debugger and be able to see what caused the exeception.
With Xcode 4.2 and iOS 5 uncaught exceptions do not seem to show in the console anymore. I would recommend adding the following or modifying your existing uncaught exception handler to dump the exceptions callstack for you.
#ifdef DEBUG
void eHandler(NSException *);
void eHandler(NSException *exception) {
NSLog(#"%#", exception);
NSLog(#"%#", [exception callStackSymbols]);
}
#endif
int main(int argc, char *argv[]) {
#ifdef DEBUG
NSSetUncaughtExceptionHandler(&eHandler);
#endif
...rest of your main function here...
}
The easiest way for this kind of crashes which are occuring during development is to add exception break points.
You can add exception breakpoint like below
Select the break points option in left menu in XCode
Add the exception break point
Add breakpoint for all the exceptions
Run the app. In most of the cases when exception occurs XCode will stop the execution and show you the line which caused the exception.

StoreKit SKProductsRequest Crash

I use the following code to request a list of products as per the In-App Purchase Programming Guide. It used to work fine in my iPhone application, however now it crashes every time the product list is requested. The delegate method (void)productsRequest:(SKProductsRequest **)request didReceiveResponse:(SKProductsResponse **)response is never called.
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:#"my.product.identifier"]];
[request setDelegate:self];
[request start];
As I said, it worked perfectly fine, then just stopped working. This is the crash which occurs when the above code is called.
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000011
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x000034f8 objc_msgSend + 24
1 StoreKit 0x00003e18 -[SKProductsRequest handleFinishResponse:returningError:] + 40
2 StoreKit 0x000050c4 -[SKRequest _requestFinishedNotification:] + 152
3 Foundation 0x00019b9a _nsnote_callback + 150
4 CoreFoundation 0x0006c2de __CFXNotificationPost_old + 390
5 CoreFoundation 0x0001ab32 _CFXNotificationPostNotification + 122
6 Foundation 0x000048e4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
7 AppSupport 0x0000bb42 -[CPDistributedNotificationCenter deliverNotification:userInfo:] + 38
8 AppSupport 0x0000cf66 _CPDNDeliverNotification + 198
9 AppSupport 0x0000ba4a _XDeliverNotification + 110
10 AppSupport 0x00002e82 migHelperRecievePortCallout + 122
11 CoreFoundation 0x000742ac __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 22
12 CoreFoundation 0x000761d6 __CFRunLoopDoSource1 + 158
13 CoreFoundation 0x0007718e __CFRunLoopRun + 574
14 CoreFoundation 0x0001e0bc CFRunLoopRunSpecific + 220
15 CoreFoundation 0x0001dfca CFRunLoopRunInMode + 54
16 GraphicsServices 0x00003f88 GSEventRunModal + 188
17 UIKit 0x00007b40 -[UIApplication _run] + 564
18 UIKit 0x00005fb8 UIApplicationMain + 964
19 myapp 0x00002fae main (main.m:13)
20 myapp 0x00002f58 start + 32
Thread 1:
0 libSystem.B.dylib 0x00034e84 kevent + 24
1 libSystem.B.dylib 0x00102a48 _dispatch_mgr_invoke + 88
2 libSystem.B.dylib 0x00102494 _dispatch_queue_invoke + 96
3 libSystem.B.dylib 0x00102634 _dispatch_worker_thread2 + 120
4 libSystem.B.dylib 0x0008b53c _pthread_wqthread + 392
5 libSystem.B.dylib 0x00082b6c start_wqthread + 0
Thread 2:
0 libSystem.B.dylib 0x00000ab0 mach_msg_trap + 20
1 libSystem.B.dylib 0x00002f94 mach_msg + 60
2 CoreFoundation 0x00074b18 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x000770e0 __CFRunLoopRun + 400
4 CoreFoundation 0x0001e0bc CFRunLoopRunSpecific + 220
5 CoreFoundation 0x0001dfca CFRunLoopRunInMode + 54
6 WebCore 0x0000370c RunWebThread(void*) + 552
7 libSystem.B.dylib 0x0008af80 _pthread_start + 364
8 libSystem.B.dylib 0x0007d014 thread_start + 0
Thread 3:
0 libSystem.B.dylib 0x00000ab0 mach_msg_trap + 20
1 libSystem.B.dylib 0x00002f94 mach_msg + 60
2 CoreFoundation 0x00074b18 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x000770e0 __CFRunLoopRun + 400
4 CoreFoundation 0x0001e0bc CFRunLoopRunSpecific + 220
5 CoreFoundation 0x0001dfca CFRunLoopRunInMode + 54
6 Foundation 0x0003c316 +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 210
7 Foundation 0x0000c612 -[NSThread main] + 42
8 Foundation 0x00092140 __NSThread__main__ + 908
9 libSystem.B.dylib 0x0008af80 _pthread_start + 364
10 libSystem.B.dylib 0x0007d014 thread_start + 0
Thread 4:
0 libSystem.B.dylib 0x00029f24 select$DARWIN_EXTSN + 20
1 CoreFoundation 0x0007aa54 __CFSocketManager + 340
2 libSystem.B.dylib 0x0008af80 _pthread_start + 364
3 libSystem.B.dylib 0x0007d014 thread_start + 0
I don't know what is causing the objc_msgSend crash, or how it is related to StoreKit. I also have no idea what I added or changed which caused this simple code to stop working.
A very likely explanation is whether the object you set as a delegate for the SKProductRequest object might have been deallocated already.
It is quite possible for the request to take a few seconds to complete, and this might be past the lifetime of your delegate object, so you may want to make sure it sticks around for long enough.
The answer above is technically correct but it is not complete. As Megastep said "the object you set as the delegate for the SKProductsRequest may have already been deallocated." Therefore you are sending a message to an object that has already been deallocated. Now onto the actual answer:
- (void)requestProUpgradeProductData {
NSSet *productIdentifiers = //Your Product IDs go here
productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
productsRequest.delegate = self;
[productsRequest start];
// we will release the request object in the delegate callback
}
#pragma mark -
#pragma mark SKProductRequest Delegate Methods
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse(SKProductsResponse *)response {
self.products = response.products;
//NSLog(#"%i",[products count]);
proUpgradeProduct = [products count] == 4 ? [[products objectAtIndex:0] retain] : nil;
if (proUpgradeProduct)
{
//Do your stuff here...
}
for (NSString *invalidProductId in response.invalidProductIdentifiers)
{
//NSLog(#"Invalid product id: %#" , invalidProductId);
}
// finally release the reqest we alloc/init’ed in requestProUpgradeProductData
[productsRequest release];
[[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerProductsFetchedNotification object:self userInfo:nil];
}
So basically as you can see above you do not need to release productsRequest because it is already being released in the delegate callback method. Again you do not need to call productsRequest release or set it Nil in viewDidUnload/dealloc method because that could cause a crash if you dismiss the view before the callback method gets called.
I'm using an object like a delegate. So in the deinit method of this object i remove the delegate a and crash has been fixed.
private var currentProductRequest: SKProductsRequest?
deinit {
if let r = currentProductRequest {
r.delegate = nil
r.cancel()
currentProductRequest = nil
}
}