Cocoa App crash calling a 3rd party API - objective-c

My Cocoa Objective-C app (in XCode) occasionally crashes in the part where it calls a 3rd party API. I believe that it's a memory leak or something. I attach the part where my program will, the 3rd party API and the crash log.
Please help to give me pointers on how I can solve this. Thanks a lot!
My code:
.
.
.
uint8_t InfoProg[4];//10
uint8_t nInfoProg = 4;//10
uint8_t ret;
NSString *result;
NSLog(#"***Calling GetConnectedProgramers***");
ret = GetConnectedProgrammers(InfoProg, nInfoProg); // The part where it crashes sometimes
.
.
.
3rd party API function:
/**
GET INFO ON CONNECTED USB PROGRAMMERS
reports back the number of connected USB programmer devices on the host
#param InfoProg
points to the memory that will be filled with the info on the connected
USB programmers;
it is the responsibility of the application to allocate this memory
and to size it sufficiently. This should be an buffer with at least 8 bytes.
InfoProg[x] = 0; no USB programmer allocated to that number
InfoProg[x] = 1; USB programmer allocated to that number = USB programmer available
#param nInfoProg
is the number of requested data structures
#return
is the number of programmers connected
*/
uint8_t GetConnectedProgrammers (uint8_t *InfoProg, uint8_t nInfoProg);
Crash Report:
Process: FCT_MACOS [575]
Path: /Virgo_FG2_EVT/FCT_MACOS3p55c.app/Contents/MacOS/FCT_MACOS
Identifier: com.TopTest.FCTMACOS
Version: 3.55c (3.55c)
Code Type: X86 (Native)
Parent Process: launchd [132]
Date/Time: 2012-08-03 10:34:35.151 +0800
OS Version: Mac OS X 10.7.3 (11D2001)
Report Version: 9
Interval Since Last Report: 16921 sec
Crashes Since Last Report: 3
Per-App Interval Since Last Report: 5164 sec
Per-App Crashes Since Last Report: 3
Anonymous UUID: 22314E10-99B9-4989-A2E8-53631295027B
Crashed Thread: 4
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000000005a5
VM Regions Near 0x5a5:
--> __PAGEZERO 0000000000000000-0000000000001000 [ 4K] ---/--- SM=NUL /Virgo_FG2_EVT/FCT_MACOS3p55c.app/Contents/MacOS/FCT_MACOS
VM_ALLOCATE 0000000000001000-0000000000013000 [ 72K] ---/--- SM=NUL
Application Specific Information:
objc_msgSend() selector name: isEqual:
objc[575]: garbage collection is OFF
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x964edc22 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x964ed1f6 mach_msg + 70
2 com.apple.CoreFoundation 0x9677ec7a __CFRunLoopServiceMachPort + 170
3 com.apple.CoreFoundation 0x96787da4 __CFRunLoopRun + 1428
4 com.apple.CoreFoundation 0x9678747c CFRunLoopRunSpecific + 332
5 com.apple.CoreFoundation 0x96787328 CFRunLoopRunInMode + 120
6 com.apple.HIToolbox 0x9973417f RunCurrentEventLoopInMode + 318
7 com.apple.HIToolbox 0x9973b4e7 ReceiveNextEventCommon + 381
8 com.apple.HIToolbox 0x9973b356 BlockUntilNextEventMatchingListInMode + 88
9 com.apple.AppKit 0x957dfa9c _DPSNextEvent + 678
10 com.apple.AppKit 0x957df306 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 113
11 com.apple.AppKit 0x957db675 -[NSApplication run] + 911
12 com.apple.AppKit 0x95a6f261 NSApplicationMain + 1054
13 com.TopTest.FCTMACOS 0x00014055 start + 53
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x964f090a kevent + 10
1 libdispatch.dylib 0x97c1dc58 _dispatch_mgr_invoke + 969
2 libdispatch.dylib 0x97c1c6a7 _dispatch_mgr_thread + 53
Thread 2:
0 libsystem_kernel.dylib 0x964f0ef2 __sem_wait + 10
1 com.ni.framework.nipalu 0x001ebd0b tTimerTimeWasterSleep::sleep(u64, tTimerTimeUnit, long*) const + 3019
2 com.ni.framework.NI4882 0x06cad33c WaitSRQ + 99996
3 com.ni.framework.nipalu 0x001edc78 tThreadUtility::getCurrentThreadId() + 104
4 libsystem_c.dylib 0x918aeed9 _pthread_start + 335
5 libsystem_c.dylib 0x918b26de thread_start + 34
Thread 3:
0 libsystem_kernel.dylib 0x964edc22 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x964ed1f6 mach_msg + 70
2 com.apple.framework.IOKit 0x982f92df io_connect_method + 465
3 com.apple.framework.IOKit 0x982a9f21 IOConnectCallMethod + 559
4 com.apple.framework.IOKit 0x982aa21b IOConnectCallStructMethod + 84
5 com.ni.framework.nipalu 0x001f11f1 tThreadUtility::yield(iThreadController*, long*) + 12993
6 com.ni.framework.nipalu 0x001ec4b3 tTimerTimeWasterSleep::sleep(u64, tTimerTimeUnit, long*) const + 4979
7 com.ni.framework.NI4882 0x06c9940a WaitSRQ + 18282
8 com.ni.framework.nipalu 0x001edc78 tThreadUtility::getCurrentThreadId() + 104
9 libsystem_c.dylib 0x918aeed9 _pthread_start + 335
10 libsystem_c.dylib 0x918b26de thread_start + 34
Thread 4 Crashed:
0 libobjc.A.dylib 0x915bcd47 objc_msgSend + 23
1 com.apple.CoreFoundation 0x9675b57a CFEqual + 154
2 com.apple.framework.IOKit 0x982cbc80 IOHIDDeviceUnscheduleFromRunLoop + 29
3 com.TopTest.FCTMACOS 0x0008dee2 closeAll + 66
4 com.apple.CoreFoundation 0x967ea298 -[NSObject performSelector:withObject:withObject:] + 72
5 com.TopTest.FCTMACOS 0x000213ff -[TestViewController threadRunTest:] + 2593
6 com.apple.Foundation 0x97ddbe59 -[NSThread main] + 45
7 com.apple.Foundation 0x97ddbe09 __NSThread__main__ + 1582
8 libsystem_c.dylib 0x918aeed9 _pthread_start + 335
9 libsystem_c.dylib 0x918b26de thread_start + 34
Thread 5:
0 libsystem_kernel.dylib 0x964f002e __workq_kernreturn + 10
1 libsystem_c.dylib 0x918b0ccf _pthread_wqthread + 773
2 libsystem_c.dylib 0x918b26fe start_wqthread + 30
Thread 6:
0 libsystem_kernel.dylib 0x964f002e __workq_kernreturn + 10
1 libsystem_c.dylib 0x918b0ccf _pthread_wqthread + 773
2 libsystem_c.dylib 0x918b26fe start_wqthread + 30
Thread 7:
0 libsystem_kernel.dylib 0x964f002e __workq_kernreturn + 10
1 libsystem_c.dylib 0x918b0ccf _pthread_wqthread + 773
2 libsystem_c.dylib 0x918b26fe start_wqthread + 30
Thread 8:
0 libsystem_kernel.dylib 0x964f002e __workq_kernreturn + 10
1 libsystem_c.dylib 0x918b0ccf _pthread_wqthread + 773
2 libsystem_c.dylib 0x918b26fe start_wqthread + 30
Thread 9:
0 libsystem_kernel.dylib 0x964f002e __workq_kernreturn + 10
1 libsystem_c.dylib 0x918b0ccf _pthread_wqthread + 773
2 libsystem_c.dylib 0x918b26fe start_wqthread + 30
Thread 10:
0 libsystem_kernel.dylib 0x964efbb2 __semwait_signal + 10
1 libsystem_c.dylib 0x918637b9 nanosleep$UNIX2003 + 187
2 com.apple.Foundation 0x97e1c05f +[NSThread sleepForTimeInterval:] + 170
3 com.TopTest.FCTMACOS 0x0006cbd7 -[RS232 threadB139RS232Read:] + 223
4 com.apple.Foundation 0x97ddbe59 -[NSThread main] + 45
5 com.apple.Foundation 0x97ddbe09 __NSThread__main__ + 1582
6 libsystem_c.dylib 0x918aeed9 _pthread_start + 335
7 libsystem_c.dylib 0x918b26de thread_start + 34
Thread 4 crashed with X86 Thread State (32-bit):
eax: 0x78690d00 ebx: 0xac7d8724 ecx: 0x96128a48 edx: 0x00000585
edi: 0x7868cc80 esi: 0x78615800 ebp: 0xb0102c18 esp: 0xb0102bf8
ss: 0x00000023 efl: 0x00010206 eip: 0x915bcd47 cs: 0x0000001b
ds: 0x00000023 es: 0x00000023 fs: 0x00000023 gs: 0x0000000f
cr2: 0x000005a5
Logical CPU: 2
...

From the docs;
#param InfoProg
This should be an buffer with at least 8 bytes.
but
uint8_t InfoProg[4];
only consists of 4 uint8_t (bytes). Try increasing your buffer.

Related

NSUserDefaults integerForKey EXC_BAD_ACCESS?

I'm using NSUserDefaults in my application. I received quite a lot crash reports with code that crashes on
[[NSUserDefaults standardUserDefaults] integerForKey:MY_KEY];
with EXC_BAD_ACCESS.
Constants are defined in separate .h header files.
static NSString *const MY_KEY = #"myKey";
static NSInteger const SOME_VALUE = 0;
Part of controller method that crashes
- (void)displayData:(NSInteger)param {
NSString *string1;
NSString *string2;
NSInteger value = [[NSUserDefaults standardUserDefaults] integerForKey: MY_KEY];
}
This is the crash report in Xcode Organizer
This is the crash log
Incident Identifier: 1DD7D3CD-DE9B-4623-AB02-06D2365728DA
CrashReporter Key: 020e241bb4242d3e055b3eef0f3ab86f54af59df
Hardware Model: iPhone6,2
Process: My App [194]
Path: /private/var/mobile/Containers/Bundle/Application/31286A32-F4D3-48E1-8B05-ECE119EA96A8/MyApp.app/My App
Identifier: com.mycompany.myapp
Version: 1.0.0 (1.0.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2016-01-16 12:55:34.34 +0200
Launch Time: 2016-01-16 12:24:31.31 +0200
OS Version: iOS 9.2 (13C75)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000158b6560
Triggered by Thread: 0
Filtered syslog:
None found
Global Trace Buffer (reverse chronological seconds):
1.629540 CFNetwork 0x00000001851af104 TCP Conn 0x15a473640 complete. fd: 8, err: 0
1.629540 CFNetwork 0x00000001851b0630 TCP Conn 0x15a473640 event 1. err: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x00000001841b5bd0 objc_msgSend + 16
1 CoreFoundation 0x0000000184b69118 __CFBasicHashAddValue + 328
2 CoreFoundation 0x0000000184a179d8 CFBasicHashAddValue + 288
3 CoreFoundation 0x0000000184a18c90 CFDictionaryAddValue + 248
4 CoreFoundation 0x0000000184a305a8 __CFDictionaryApplyFunction_block_invoke + 24
5 CoreFoundation 0x0000000184a189bc CFBasicHashApply + 128
6 CoreFoundation 0x0000000184a21d3c CFDictionaryApplyFunction + 200
7 CoreFoundation 0x0000000184abd8a8 -[CFPrefsPlistSource mergeIntoDictionary:] + 304
8 CoreFoundation 0x0000000184ae45e0 -[CFPrefsSearchListSource alreadylocked_copyDictionary] + 828
9 CoreFoundation 0x0000000184ae33fc -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 72
10 CoreFoundation 0x0000000184b74ee4 ___CFPreferencesCopyAppValueWithContainer_block_invoke + 68
11 CoreFoundation 0x0000000184ae25b8 +[CFPrefsSearchListSource withSearchListForIdentifier:container:perform:] + 572
12 CoreFoundation 0x0000000184b74e5c _CFPreferencesCopyAppValueWithContainer + 188
13 CoreFoundation 0x0000000184b75130 _CFPreferencesGetAppIntegerValueWithContainer + 28
14 My App 0x000000010006f520 -[MyController displayData:] (MyController.m:998)
15 Foundation 0x0000000185425844 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 988
16 Foundation 0x00000001854296a0 -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 144
17 My App 0x000000010006cd68 -[MyController StateDidChange:] (MyController.m:307)
18 Foundation 0x00000001854f7e20 __NSThreadPerformPerform + 340
19 CoreFoundation 0x0000000184aecefc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
20 CoreFoundation 0x0000000184aec990 __CFRunLoopDoSources0 + 540
21 CoreFoundation 0x0000000184aea690 __CFRunLoopRun + 724
22 CoreFoundation 0x0000000184a19680 CFRunLoopRunSpecific + 384
23 GraphicsServices 0x0000000185f28088 GSEventRunModal + 180
24 UIKit 0x0000000189890d90 UIApplicationMain + 204
25 My App 0x000000010006b6b4 main (main.m:16)
26 libdyld.dylib 0x00000001845ba8b8 start + 4
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x00000001846d94fc kevent_qos + 8
1 libdispatch.dylib 0x000000018459c94c _dispatch_mgr_invoke + 232
2 libdispatch.dylib 0x000000018458b7bc _dispatch_source_invoke + 0
Thread 2 name: com.apple.NSURLConnectionLoader
Thread 2:
0 libsystem_kernel.dylib 0x00000001846bd4bc mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001846bd338 mach_msg + 72
2 CoreFoundation 0x0000000184aecac0 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x0000000184aea7c4 __CFRunLoopRun + 1032
4 CoreFoundation 0x0000000184a19680 CFRunLoopRunSpecific + 384
5 CFNetwork 0x0000000185189434 +[NSURLConnection(Loader) _resourceLoadLoop:] + 412
6 Foundation 0x00000001854f7c40 __NSThread__start__ + 1000
7 libsystem_pthread.dylib 0x000000018479fb28 _pthread_body + 156
8 libsystem_pthread.dylib 0x000000018479fa8c _pthread_body + 0
9 libsystem_pthread.dylib 0x000000018479d028 thread_start + 4
Thread 3 name: com.apple.CFSocket.private
Thread 3:
0 libsystem_kernel.dylib 0x00000001846d8368 __select + 8
1 CoreFoundation 0x0000000184af3028 __CFSocketManager + 648
2 libsystem_pthread.dylib 0x000000018479fb28 _pthread_body + 156
3 libsystem_pthread.dylib 0x000000018479fa8c _pthread_body + 0
4 libsystem_pthread.dylib 0x000000018479d028 thread_start + 4
Thread 4 name: NetworkLoad
Thread 4:
0 libsystem_kernel.dylib 0x00000001846bd4bc mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001846bd338 mach_msg + 72
2 CoreFoundation 0x0000000184aecac0 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x0000000184aea7c4 __CFRunLoopRun + 1032
4 CoreFoundation 0x0000000184a19680 CFRunLoopRunSpecific + 384
5 GeoServices 0x000000018b1e9b5c _runNetworkThread + 428
6 libsystem_pthread.dylib 0x000000018479fb28 _pthread_body + 156
7 libsystem_pthread.dylib 0x000000018479fa8c _pthread_body + 0
8 libsystem_pthread.dylib 0x000000018479d028 thread_start + 4
Thread 5:
0 libsystem_kernel.dylib 0x00000001846d8b6c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000018479d530 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x000000018479d020 start_wqthread + 4
Thread 6:
0 libsystem_kernel.dylib 0x00000001846d8b6c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000018479d530 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x000000018479d020 start_wqthread + 4
Thread 7:
0 libsystem_kernel.dylib 0x00000001846d8b6c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000018479d530 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x000000018479d020 start_wqthread + 4
Thread 8:
0 libsystem_kernel.dylib 0x00000001846d8b6c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000018479d530 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x000000018479d020 start_wqthread + 4
Thread 9:
0 libsystem_kernel.dylib 0x00000001846d7f48 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x000000018479ece8 _pthread_cond_wait + 648
2 Foundation 0x0000000185462bac -[NSCondition wait] + 240
3 Foundation 0x0000000185425780 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 792
4 Foundation 0x00000001854296a0 -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 144
5 My App 0x0000000100085714 -[AppStateManager HandleAsynchRequest:] (AppStateManager.m:328)
6 Foundation 0x00000001854f7c40 __NSThread__start__ + 1000
7 libsystem_pthread.dylib 0x000000018479fb28 _pthread_body + 156
8 libsystem_pthread.dylib 0x000000018479fa8c _pthread_body + 0
9 libsystem_pthread.dylib 0x000000018479d028 thread_start + 4
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000155616b10 x1: 0x000000018a206102 x2: 0x00000001556169c0 x3: 0x0000000155616b10
x4: 0x000000015680c2c0 x5: 0x0000000000000010 x6: 0x0000000000000067 x7: 0x0000000000000fd0
x8: 0x00000001a1223000 x9: 0x00000000158b6550 x10: 0x00000001a216a000 x11: 0x00000001a216a000
x12: 0x00000001556169d0 x13: 0x10000000158b6554 x14: 0x000000000000008c x15: 0x00000001556169dd
x16: 0x5000f8d3b4fb11e2 x17: 0x00000001556169dd x18: 0x0000000000000000 x19: 0x000000015680c240
x20: 0x00000001556169c0 x21: 0x0000000155616b10 x22: 0x0000000000000001 x23: 0x00000001a2165360
x24: 0x0000000184aee6c8 x25: 0x00000001a2165360 x26: 0x0000000000000003 x27: 0x0000000158ffa300
x28: 0x00000000a7baadb1 fp: 0x000000016fd99f50 lr: 0x0000000184b69118
sp: 0x000000016fd99f00 pc: 0x00000001841b5bd0 cpsr: 0x20000000
I'm getting this message with zombies enabled
[CFString retain]: message sent to deallocated instance 0x12f78f7e0
I replicated this bug once on my development iPhone. Also note that the application uses real-time TCP communication. When I receive some data a block is created to show the data in the UI.
Can NSUserDefaults produce a EXC_BAD_ACCESS?
It's an issue related to memory leaks. To solve the problem use Xcode static analysis to find potential memory leaks in the code. Also run Xcode instruments with Leaks configuration.

Intermittent iPad app crash using Swift

I have been seeing the following crash intermittently in my app. Following is the crash log for the crash. I am not able to figure out the cause for this crash. I would really appreciate if anyone could help me with the reason behind this crash.
CRASHLOG:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000000000defe
Triggered by Thread: 5
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x34515648 syscall_thread_switch + 8
1 libsystem_platform.dylib 0x345a2646 _OSSpinLockLockSlow$VARIANT$mp + 42
2 CFNetwork 0x25df2f7e _BrowserCancel(__CFNetServiceBrowser*) + 22
3 CoreFoundation 0x2631f804 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
4 CoreFoundation 0x2631ec16 __CFRunLoopDoSources0 + 218
5 CoreFoundation 0x2631d294 __CFRunLoopRun + 764
6 CoreFoundation 0x2626adac CFRunLoopRunSpecific + 472
7 CoreFoundation 0x2626abbe CFRunLoopRunInMode + 102
8 GraphicsServices 0x2d5dc04c GSEventRunModal + 132
9 UIKit 0x29836a2c UIApplicationMain + 1436
10 Xavier 0x000c85c4 0x6c000 + 378308
11 Xavier 0x000c8720 0x6c000 + 378656
12 libdyld.dylib 0x34463aac start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x345152c8 kevent64 + 24
1 libdispatch.dylib 0x34437ec4 _dispatch_mgr_invoke + 276
2 libdispatch.dylib 0x34437bf6 _dispatch_mgr_thread$VARIANT$mp + 34
Thread 2 name: com.apple.CFSocket.private
Thread 2:
0 libsystem_kernel.dylib 0x3452908c __select + 20
1 CoreFoundation 0x2632354e __CFSocketManager + 486
2 libsystem_pthread.dylib 0x345a7e64 _pthread_body + 136
3 libsystem_pthread.dylib 0x345a7dd6 _pthread_start + 114
4 libsystem_pthread.dylib 0x345a5b80 thread_start + 4
Thread 3 name: com.apple.NSURLConnectionLoader
Thread 3:
0 libsystem_kernel.dylib 0x34515518 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3451530c mach_msg + 36
2 CoreFoundation 0x2631edc6 __CFRunLoopServiceMachPort + 142
3 CoreFoundation 0x2631d38c __CFRunLoopRun + 1012
4 CoreFoundation 0x2626adac CFRunLoopRunSpecific + 472
5 CoreFoundation 0x2626abbe CFRunLoopRunInMode + 102
6 CFNetwork 0x25e231fa +[NSURLConnection(Loader) _resourceLoadLoop:] + 482
7 Foundation 0x270671b6 __NSThread__main__ + 1114
8 libsystem_pthread.dylib 0x345a7e64 _pthread_body + 136
9 libsystem_pthread.dylib 0x345a7dd6 _pthread_start + 114
10 libsystem_pthread.dylib 0x345a5b80 thread_start + 4
Thread 4:
0 libsystem_kernel.dylib 0x34515518 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3451530c mach_msg + 36
2 CoreFoundation 0x2631edc6 __CFRunLoopServiceMachPort + 142
3 CoreFoundation 0x2631d38c __CFRunLoopRun + 1012
4 CoreFoundation 0x2626adac CFRunLoopRunSpecific + 472
5 CoreFoundation 0x262b46c6 CFRunLoopRun + 94
6 CoreMotion 0x26b6bb7a 0x26b2d000 + 256890
7 libsystem_pthread.dylib 0x345a7e64 _pthread_body + 136
8 libsystem_pthread.dylib 0x345a7dd6 _pthread_start + 114
9 libsystem_pthread.dylib 0x345a5b80 thread_start + 4
Thread 5 name: Dispatch queue: com.apple.MCSession.callbackQueue
Thread 5 Crashed:
0 libswiftCore.dylib 0x0049b69c 0x304000 + 1668764
1 Xavier 0x000d4af8 0x6c000 + 428792
2 Xavier 0x000d5008 0x6c000 + 430088
3 MultipeerConnectivity 0x2824ba26 __58-[MCSession syncHandleNetworkEvent:pid:freeEventWhenDone:]_block_invoke617 + 114
4 libdispatch.dylib 0x34428610 _dispatch_call_block_and_release + 8
5 libdispatch.dylib 0x34432714 _dispatch_queue_drain$VARIANT$mp + 944
6 libdispatch.dylib 0x344321e4 _dispatch_queue_invoke$VARIANT$mp + 80
7 libdispatch.dylib 0x34434156 _dispatch_root_queue_drain + 310
8 libdispatch.dylib 0x3443527a _dispatch_worker_thread3 + 102
9 libsystem_pthread.dylib 0x345a5e22 _pthread_wqthread + 666
10 libsystem_pthread.dylib 0x345a5b74 start_wqthread + 4
Thread 6:
0 libsystem_kernel.dylib 0x345299cc __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x345a5e9c _pthread_wqthread + 788
2 libsystem_pthread.dylib 0x345a5b74 start_wqthread + 4
Thread 7:
0 libsystem_kernel.dylib 0x345299cc __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x345a5e9c _pthread_wqthread + 788
2 libsystem_pthread.dylib 0x345a5b74 start_wqthread + 4
Thread 8:
0 libsystem_kernel.dylib 0x345299cc __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x345a5e9c _pthread_wqthread + 788
2 libsystem_pthread.dylib 0x345a5b74 start_wqthread + 4
Thread 9:
0 libsystem_kernel.dylib 0x345299cc __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x345a5e9c _pthread_wqthread + 788
2 libsystem_pthread.dylib 0x345a5b74 start_wqthread + 4
Thread 10 name: com.apple.gamekitservices.gcksession.recvproc
Thread 10:
0 libsystem_kernel.dylib 0x3452908c __select + 20
1 MultipeerConnectivity 0x2825f8cc gckSessionRecvProc + 5252
2 libsystem_pthread.dylib 0x345a7e64 _pthread_body + 136
3 libsystem_pthread.dylib 0x345a7dd6 _pthread_start + 114
4 libsystem_pthread.dylib 0x345a5b80 thread_start + 4
Thread 11 name: com.apple.gamekitservices.gcksession.sendproc
Thread 11:
0 libsystem_kernel.dylib 0x3452908c __select + 20
1 MultipeerConnectivity 0x2825fe68 gckSessionSendProc + 268
2 libsystem_pthread.dylib 0x345a7e64 _pthread_body + 136
3 libsystem_pthread.dylib 0x345a7dd6 _pthread_start + 114
4 libsystem_pthread.dylib 0x345a5b80 thread_start + 4
Thread 12 name: com.apple.gamekitservices.eventcallback.eventcbproc
Thread 12:
0 libsystem_kernel.dylib 0x34528b38 __psynch_cvwait + 24
1 libsystem_pthread.dylib 0x345a73dc _pthread_cond_wait + 516
2 libsystem_pthread.dylib 0x345a82ac pthread_cond_wait + 36
3 MultipeerConnectivity 0x28279a4c EventCBProc + 76
4 libsystem_pthread.dylib 0x345a7e64 _pthread_body + 136
5 libsystem_pthread.dylib 0x345a7dd6 _pthread_start + 114
6 libsystem_pthread.dylib 0x345a5b80 thread_start + 4
Thread 13:
0 libsystem_kernel.dylib 0x34528b38 __psynch_cvwait + 24
1 libsystem_pthread.dylib 0x345a7416 _pthread_cond_wait + 574
2 libsystem_pthread.dylib 0x345a71d0 pthread_cond_timedwait_relative_np + 12
3 MultipeerConnectivity 0x2825de5c gckSessionRecvUDPPacketWithTimeout + 252
4 ICE 0x2d297234 ICERecvUDPPacketWithTimeout + 340
5 ICE 0x2d29eed2 RecvAndProcess + 310
6 ICE 0x2d2a2d1e ConnectivityCheckProc + 894
7 libsystem_pthread.dylib 0x345a7e64 _pthread_body + 136
8 libsystem_pthread.dylib 0x345a7dd6 _pthread_start + 114
9 libsystem_pthread.dylib 0x345a5b80 thread_start + 4
Thread 5 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x29f6be18 r2: 0x34e7b7e4 r3: 0x00000000
r4: 0x17de21f0 r5: 0x2d34620a r6: 0x17de60d0 r7: 0x00852bc8
r8: 0x17de60d0 r9: 0x18a6a4c0 r10: 0x36c40660 r11: 0x00000000
ip: 0x33ee2531 sp: 0x00852bc4 lr: 0x33ee25c3 pc: 0x0049b69c
cpsr: 0x60000030
My breakpoint hits this line before it crashes:
let rootVC: UINavigationController = UIApplication.sharedApplication().keyWindow.rootViewController as UINavigationController
Following is the whole method that contains this line:
func session(session: MCSession!, didReceiveData data: NSData!, fromPeer peerID: MCPeerID!) {
//Check to see what kind of data is received
var dataReceived:AnyObject = NSKeyedUnarchiver.unarchiveObjectWithData(data)!;
if let newData = dataReceived as? String {
let rootVC: UINavigationController = UIApplication.sharedApplication().keyWindow.rootViewController as UINavigationController;
let topVC = rootVC.topViewController;
if let block = self.commandResolver[newData] {
block(topVC);
return;
} else {
println("Command resolver returns nil block");
}
} else if let newData = dataReceived as? NSDictionary {
let rootVC: UINavigationController = UIApplication.sharedApplication().keyWindow.rootViewController as UINavigationController;
let topVC = rootVC.topViewController as ViewController;
topVC.connected(true, withGroupName: newData["GroupName"] as String!);
} else {
println("Data is not a String");
}
}
My window.rootViewController is UINavigationController so it should not be nil if that is the problem. Can it be though?
I would really appreciate your help guys.
It's crashing in a background thread inside this block:
3 MultipeerConnectivity 0x2824ba26 __58-[MCSession syncHandleNetworkEvent:pid:freeEventWhenDone:]_block_invoke617 + 114
UIKit is generally not thread-safe and is "Main Thread only", so the fact that calling UIApplication.sharedApplication().keyWindow.rootViewController from a background thread crashes is not surprising. You probably want to dispatch this whole block back to the main thread.

iOS app crash only if run from instrument (Automation)

My app do not crash on device. No leaks no memory warning. I was living happily. But recently I was doing some UI testing with Instrument(Automation). Boom Boom. App crashes after using it like 8 min. Looping around like 30 times. And it keep crashing but after different durations but all at same step. Again no leaks no memory warning. Again it do not crash on device(without instrument) doesn't matter how long use my app.
+ Every times it crashes after I pop a specific ViewController. And that view controller is loaded with stuffs (image view, playing and recording audio, take photo from album and camera)
Here is the device log. Any kind of help is highly appreciated.
Incident Identifier:
CrashReporter Key:
Hardware Model: iPhone5,2
Process: My App [15196]
Path:
Identifier: My App
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-08-16 12:48:10.814 +0200
OS Version: iOS 6.1.3 (10B329)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x1208b319
Crashed Thread: 6
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x39be3e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x39be3fd0 mach_msg + 48
2 CoreFoundation 0x319da2b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x319d8fd6 __CFRunLoopRun + 814
4 CoreFoundation 0x3194c238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x3194c0c4 CFRunLoopRunInMode + 100
6 GraphicsServices 0x3552b336 GSEventRunModal + 70
7 UIKit 0x338682b4 UIApplicationMain + 1116
8 MyApp 0x0000531e 0x3000 + 8990
9 MyApp 0x000052d4 0x3000 + 8916
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x39be45d0 kevent64 + 24
1 libdispatch.dylib 0x39b1fd22 _dispatch_mgr_invoke + 806
2 libdispatch.dylib 0x39b1b374 _dispatch_mgr_thread + 32
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x39be3e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x39be3fd0 mach_msg + 48
2 CoreFoundation 0x319da2b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x319d902c __CFRunLoopRun + 900
4 CoreFoundation 0x3194c238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x3194c0c4 CFRunLoopRunInMode + 100
6 WebCore 0x37954390 RunWebThread(void*) + 440
7 libsystem_c.dylib 0x39b4d0de _pthread_start + 306
8 libsystem_c.dylib 0x39b4cfa4 thread_start + 4
Thread 3:
0 libsystem_kernel.dylib 0x39be3e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x39be3fd0 mach_msg + 48
2 CoreFoundation 0x319da2b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x319d902c __CFRunLoopRun + 900
4 CoreFoundation 0x3194c238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x3194c0c4 CFRunLoopRunInMode + 100
6 Foundation 0x322705be -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7 MyApp 0x00020b0a 0x3000 + 121610
8 Foundation 0x3231d22c __NSThread__main__ + 968
9 libsystem_c.dylib 0x39b4d0de _pthread_start + 306
10 libsystem_c.dylib 0x39b4cfa4 thread_start + 4
Thread 4 name: com.apple.NSURLConnectionLoader
Thread 4:
0 libsystem_kernel.dylib 0x39be3e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x39be3fd0 mach_msg + 48
2 CoreFoundation 0x319da2b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x319d902c __CFRunLoopRun + 900
4 CoreFoundation 0x3194c238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x3194c0c4 CFRunLoopRunInMode + 100
6 Foundation 0x32299888 +[NSURLConnection(Loader) _resourceLoadLoop:] + 304
7 Foundation 0x3231d22c __NSThread__main__ + 968
8 libsystem_c.dylib 0x39b4d0de _pthread_start + 306
9 libsystem_c.dylib 0x39b4cfa4 thread_start + 4
Thread 5 name: com.apple.CFSocket.private
Thread 5:
0 libsystem_kernel.dylib 0x39bf4594 __select + 20
1 CoreFoundation 0x319de474 __CFSocketManager + 676
2 libsystem_c.dylib 0x39b4d0de _pthread_start + 306
3 libsystem_c.dylib 0x39b4cfa4 thread_start + 4
Thread 6 Crashed:
0 Foundation 0x3231d692 __NSFinalizeThreadData + 122
1 CoreFoundation 0x319d6212 __CFTSDFinalize + 62
2 libsystem_c.dylib 0x39b3feb8 _pthread_tsd_cleanup + 172
3 libsystem_c.dylib 0x39b3fb8e _pthread_exit + 114
4 libsystem_c.dylib 0x39b42ade _pthread_workq_return + 22
5 libsystem_c.dylib 0x39b427f2 _pthread_wqthread + 362
6 libsystem_c.dylib 0x39b42680 start_wqthread + 4
Thread 7:
0 libsystem_kernel.dylib 0x39bf4d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x39b42ad6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x39b427f2 _pthread_wqthread + 362
3 libsystem_c.dylib 0x39b42680 start_wqthread + 4
Thread 8:
0 libsystem_kernel.dylib 0x39bf4d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x39b42ad6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x39b427f2 _pthread_wqthread + 362
3 libsystem_c.dylib 0x39b42680 start_wqthread + 4
Thread 9 name: AURemoteIO::IOThread
Thread 9:
0 libsystem_kernel.dylib 0x39be3e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x39be3fd0 mach_msg + 48
2 AudioToolbox 0x314cdc80 AURemoteIO::IOThread::Run() + 104
3 AudioToolbox 0x314d000c AURemoteIO::IOThread::Entry(void*) + 4
4 AudioToolbox 0x3140d9f2 CAPThread::Entry(CAPThread*) + 294
5 libsystem_c.dylib 0x39b4d0de _pthread_start + 306
6 libsystem_c.dylib 0x39b4cfa4 thread_start + 4
Thread 6 crashed with ARM Thread State (32-bit):
r0: 0x0010f522 r1: 0x39700941 r2: 0x39e57e88 r3: 0x1f8dc028
r4: 0x1208b2fd r5: 0x0000001c r6: 0x00000000 r7: 0x04af9f18
r8: 0x1f8dc028 r9: 0x007f8014 r10: 0x00000004 r11: 0x00000037
ip: 0x39d4db30 sp: 0x04af9d50 lr: 0x31946eb7 pc: 0x3231d692
cpsr: 0x20000030
EXC_BAD_ACCESS generally means that you are sending a objective c message to an invalid memory address. This happens because an object that you are using has been deallocated.
Use NSZombieEnabled to get more information.
Start commenting out stuff. It's a memory issue, find the offending line of code.

Xcode 5 developer preview crash on launch [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
This Xcode 5 DP version was downloaded from internet which uploaded by anyone else. Every time i clicked it on launch up, it'll crash at once. Cuz i had installed xcode 4.6 version before, and i'm just registered as a developer, but didn't pay $99 a year for credit card.
I don't make sure this is the problem cause crashed. Any one can help me solve problems? Big appreciate for that!
This is the xcode 5 DP crash log:
Process: Xcode [561]
Path: /Applications/Xcode5-DP.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 5.0 (3322.38)
Build Info: IDEApplication-3322038000000000~4
Code Type: X86-64 (Native)
Parent Process: launchd [147]
User ID: 501
Date/Time: 2013-06-12 11:28:58.292 +0800
OS Version: Mac OS X 10.8.3 (12D78)
Report Version: 10
Interval Since Last Report: 525462 sec
Crashes Since Last Report: 25
Per-App Interval Since Last Report: 446 sec
Per-App Crashes Since Last Report: 18
Anonymous UUID: A9DA8062-D29B-6AC1-2555-14D6D838145A
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
ProductBuildVersion: 5A11314m
*** error for object 0x7fae2b97b130: pointer being freed was not allocated
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff81341212 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff844f4b54 pthread_kill + 90
2 libsystem_c.dylib 0x00007fff84538dce abort + 143
3 libsystem_c.dylib 0x00007fff8450c9b9 free + 392
4 libobjc.A.dylib 0x00007fff8ac6dfc0 object_dispose + 54
5 com.apple.dt.DVTFoundation 0x00000001040d7365 __DVTSetupKVODeallocAssertions_block_invoke_371 + 264
6 libobjc.A.dylib 0x00007fff8ac6e230 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 464
7 com.apple.CoreFoundation 0x00007fff8cbb3d72 _CFAutoreleasePoolPop + 34
8 com.apple.Foundation 0x00007fff8c475ada -[NSAutoreleasePool drain] + 154
9 com.apple.Foundation 0x00007fff8c47d580 _NSAppleEventManagerGenericHandler + 125
10 com.apple.AE 0x00007fff8da45078 aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 307
11 com.apple.AE 0x00007fff8da44ed9 dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 37
12 com.apple.AE 0x00007fff8da44d99 aeProcessAppleEvent + 318
13 com.apple.HIToolbox 0x00007fff85bae709 AEProcessAppleEvent + 100
14 com.apple.AppKit 0x00007fff88e29866 _DPSNextEvent + 1456
15 com.apple.AppKit 0x00007fff88e28e22 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
16 com.apple.AppKit 0x00007fff88e201d3 -[NSApplication run] + 517
17 com.apple.AppKit 0x00007fff88dc4c06 NSApplicationMain + 869
18 libdyld.dylib 0x00007fff881417e1 start + 1
Thread 1:
0 libsystem_kernel.dylib 0x00007fff813416d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff844f5f4c _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff844f5d13 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff844e01d1 start_wqthread + 13
Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff81341d16 kevent + 10
1 libdispatch.dylib 0x00007fff8b480dea _dispatch_mgr_invoke + 883
2 libdispatch.dylib 0x00007fff8b4809ee _dispatch_mgr_thread + 54
Thread 3:
0 libsystem_kernel.dylib 0x00007fff813416d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff844f5f4c _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff844f5d13 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff844e01d1 start_wqthread + 13
Thread 4:
0 libsystem_kernel.dylib 0x00007fff813416d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff844f5f4c _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff844f5d13 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff844e01d1 start_wqthread + 13
Thread 5:
0 libsystem_kernel.dylib 0x00007fff813416d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff844f5f4c _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff844f5d13 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff844e01d1 start_wqthread + 13
Thread 6:: Dispatch queue: com.apple.root.low-priority
0 com.apple.DiskArbitration 0x00007fff8c034fa6 _DADiskInitialize + 16
1 com.apple.DiskArbitration 0x00007fff8c034d4c __DAInitialize + 16
2 libsystem_c.dylib 0x00007fff844f4ff0 pthread_once + 87
3 com.apple.DiskArbitration 0x00007fff8c034bc7 DASessionCreate + 21
4 com.apple.AppKit 0x00007fff89071f56 __48-[NSApplication _initializeAutomaticTermination]_block_invoke_01143 + 43
5 libdispatch.dylib 0x00007fff8b481f01 _dispatch_call_block_and_release + 15
6 libdispatch.dylib 0x00007fff8b47e0b6 _dispatch_client_callout + 8
7 libdispatch.dylib 0x00007fff8b47f1fa _dispatch_worker_thread2 + 304
8 libsystem_c.dylib 0x00007fff844f5d0b _pthread_wqthread + 404
9 libsystem_c.dylib 0x00007fff844e01d1 start_wqthread + 13
Thread 7:: com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x00007fff8133f686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff8133ec42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff8cbb3233 __CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff8cbb8916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff8cbb80e2 CFRunLoopRunSpecific + 290
5 com.apple.Foundation 0x00007fff8c452b66 +[NSURLConnection(Loader) _resourceLoadLoop:] + 356
6 com.apple.Foundation 0x00007fff8c4b0cd2 __NSThread__main__ + 1345
7 libsystem_c.dylib 0x00007fff844f37a2 _pthread_start + 327
8 libsystem_c.dylib 0x00007fff844e01e1 thread_start + 13
Thread 8:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x00007fff81341322 __select + 10
1 com.apple.CoreFoundation 0x00007fff8cbf7f46 __CFSocketManager + 1302
2 libsystem_c.dylib 0x00007fff844f37a2 _pthread_start + 327
3 libsystem_c.dylib 0x00007fff844e01e1 thread_start + 13
Thread 9:
0 libsystem_kernel.dylib 0x00007fff813416d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff844f5f4c _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff844f5d13 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff844e01d1 start_wqthread + 13
Thread 10:
0 libsystem_kernel.dylib 0x00007fff813416d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff844f5f4c _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff844f5d13 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff844e01d1 start_wqthread + 13
Thread 11:
0 libsystem_kernel.dylib 0x00007fff8133f686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff8133ec42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff8cbb3233 __CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff8cbb8916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff8cbb80e2 CFRunLoopRunSpecific + 290
5 com.apple.DTDeviceKitBase 0x000000010d269f0a -[DTDKRemoteDeviceDataListener listenerThreadImplementation] + 164
6 com.apple.Foundation 0x00007fff8c4b0cd2 __NSThread__main__ + 1345
7 libsystem_c.dylib 0x00007fff844f37a2 _pthread_start + 327
8 libsystem_c.dylib 0x00007fff844e01e1 thread_start + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000006 rcx: 0x00007fff5bbf5d78 rdx: 0x0000000000000000
rdi: 0x0000000000000c07 rsi: 0x0000000000000006 rbp: 0x00007fff5bbf5da0 rsp: 0x00007fff5bbf5d78
r8: 0x00007fff717de278 r9: 0x0000000000000081 r10: 0x0000000020000000 r11: 0x0000000000000206
r12: 0x00007fae2989ce00 r13: 0x00000001050c6000 r14: 0x00007fff717df180 r15: 0x0000000000000008
rip: 0x00007fff81341212 rfl: 0x0000000000000206 cr2: 0x00007fae28832200
Logical CPU: 0
Binary Images:
0x104009000 - 0x104009ff7 com.apple.dt.Xcode (5.0 - 3322.38) <5CE4EAEB-6D86-3485-8946-05F729BD3DBB> /Applications/Xcode5-DP.app/Contents/MacOS/Xcode
0x10400e000 - 0x104429fff com.apple.dt.DVTFoundation (5.0 - 3481.6) <BB2B9FCE-80FA-39D4-9FE9-F4EC12019F2D> /Applications/Xcode5-DP.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation
0x104599000 - 0x1048b0fff com.apple.dt.DVTKit (5.0 - 3502.3) <2D8CB62B-5437-3FD3-9B99-24C55AB7197E> /Applications/Xcode5-DP.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/DVTKit
0x104a50000 - 0x104e78ff7 com.apple.dt.IDEFoundation (5.0 - 3504.7) <8CEB5828-80F5-3C6F-BBEE-F30975A5965B> /Applications/Xcode5-DP.app/Contents/Frameworks/IDEFoundation.framework/Versions/A/IDEFoundation
0x1050c9000 - 0x105841fff com.apple.dt.IDEKit (5.0 - 3527.7) <27FE8EAE-A006-3556-B57E-E5F3169DDC3F> /Applications/Xcode5-DP.app/Contents/Frameworks/IDEKit.framework/Versions/A/IDEKit
0x105caa000 - 0x105d4cfff com.apple.PackageKit (3.0 - 260) <B9C3BB80-C2A3-3E9E-A9C0-EB58B5F42512> /System/Library/PrivateFrameworks/PackageKit.framework/Versions/A/PackageKit
0x105dbc000 - 0x105dbcff7 libsysmon.dylib (2) <E029BDA7-E063-3049-95FF-BBA1AF41DFB0> /usr/lib/libsysmon.dylib
0x105e6d000 - 0x105e7cff7 libSimplifiedChineseConverter.dylib (61) <A2B475FF-667F-3B7B-A6E9-8768347F2BD6> /System/Library/CoreServices/Encodings/libSimplifiedChineseConverter.dylib
0x1066d7000 - 0x106757fff com.apple.dt.IBFoundation (1.0 - 1) <B9E81B5F-A0B9-395A-B2B4-5063A07791DC> /Applications/Xcode5-DP.app/Contents/Frameworks/IBFoundation.framework/Versions/A/IBFoundation
0x1067a6000 - 0x1067d4ff7 com.apple.CoreThemeDefinition (1.0 - 104) <BE976F3F-9085-3E00-AD9E-FC1A5458FB49> /System/Library/PrivateFrameworks/CoreThemeDefinition.framework/Versions/A/CoreThemeDefinition
0x1067f6000 - 0x10682bff7 com.apple.dt.dbg.DebuggerFoundation (5.0 - 3490.2) <8AFF3717-11FF-3B86-A78B-8E79822DC9A1> /Applications/Xcode5-DP.app/Contents/PlugIns/DebuggerFoundation.ideplugin/Contents/MacOS/DebuggerFoundation
0x106862000 - 0x107117ff7 +libclang.dylib (500.1.58) <054AB067-A22B-396F-9C48-EEC76DF12A2B> /Applications/Xcode5-DP.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib
0x107192000 - 0x1071e9fff com.apple.CSServiceClient (1.0 - 1) <BD9C72AA-FF23-324C-90ED-A4243FAD34BE> /Applications/Xcode5-DP.app/Contents/SharedFrameworks/CSServiceClient.framework/Versions/A/CSServiceClient
0x10721a000 - 0x10723cfff com.apple.DADocSetManagement (5.0 - 3338.1) <BF03D04F-3BD0-3750-B8AF-9544828510C5> /Applications/Xcode5-DP.app/Contents/SharedFrameworks/DADocSetManagement.framework/Versions/A/DADocSetManagement
0x107258000 - 0x10725aff7 com.apple.dt.DVTDeveloperModeHelper (1.0 - 1) <A3DBC1CB-A24E-3908-92A0-13EC2E56BD99> /Applications/Xcode5-DP.app/Contents/SharedFrameworks/DVTDeveloperModeHelper.framework/Versions/A/DVTDeveloperModeHelper
May be you have Xcode plugins installed.
Try to remove them.
rm ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/*

Cocos2D 2 OSX EXC_BAD_ACCESS (SIGSEGV)

I'm updating a Game I have for the Mac and the update works fine while running through XCode.
I try to Distribute through Developer ID-signed Application so I can have a friend test it and when I run the app and also give them the app it crashes just after the Main Menu. Am I exporting it wrong? Why would it run fine through XCode and then I try to export it and it crashes every time?
Here is my error log:
Crashed Thread: 6 CVDisplayLink
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000121028021
VM Regions Near 0x121028021:
CG shared images 000000011f294000-000000011f29c000 [ 32K] r--/r-- SM=SHM
-->
CG shared images 00000001c0001000-00000001c0009000 [ 32K] rw-/rw- SM=SHM
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff91ef6686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff91ef5c42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff8bf01803 __CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff8bf06ee6 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff8bf066b2 CFRunLoopRunSpecific + 290
5 com.apple.HIToolbox 0x00007fff943620a4 RunCurrentEventLoopInMode + 209
6 com.apple.HIToolbox 0x00007fff94361e42 ReceiveNextEventCommon + 356
7 com.apple.HIToolbox 0x00007fff94361cd3 BlockUntilNextEventMatchingListInMode + 62
8 com.apple.AppKit 0x00007fff961c8613 _DPSNextEvent + 685
9 com.apple.AppKit 0x00007fff961c7ed2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
10 com.apple.AppKit 0x00007fff961bf283 -[NSApplication run] + 517
11 com.apple.AppKit 0x00007fff96163cb6 NSApplicationMain + 869
12 libdyld.dylib 0x00007fff916837e1 start + 1
Thread 1:
0 libsystem_kernel.dylib 0x00007fff91ef86d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff8ce15eec _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8ce15cb3 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff8ce00171 start_wqthread + 13
Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff91ef8d16 kevent + 10
1 libdispatch.dylib 0x00007fff91fbfdea _dispatch_mgr_invoke + 883
2 libdispatch.dylib 0x00007fff91fbf9ee _dispatch_mgr_thread + 54
Thread 3:
0 libsystem_kernel.dylib 0x00007fff91ef86d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff8ce15eec _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8ce15cb3 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff8ce00171 start_wqthread + 13
Thread 4:
0 libsystem_kernel.dylib 0x00007fff91ef86d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff8ce15eec _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8ce15cb3 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff8ce00171 start_wqthread + 13
Thread 5:
0 libsystem_kernel.dylib 0x00007fff91ef86d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff8ce15eec _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8ce15cb3 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff8ce00171 start_wqthread + 13
Thread 6 Crashed:: CVDisplayLink
0 com.lasthaven.wordshufflemac 0x000000010bacc52a -[GameScene scrambleWord:] + 158 (GameScene.m:322)
1 com.lasthaven.wordshufflemac 0x000000010baced36 -[GameScene setupNewWord] + 373 (GameScene.m:878)
2 com.lasthaven.wordshufflemac 0x000000010bacb6c1 -[GameScene initializeGame] + 941 (GameScene.m:112)
3 com.lasthaven.wordshufflemac 0x000000010bacb2fc -[GameScene init] + 428 (GameScene.m:56)
4 com.lasthaven.wordshufflemac 0x000000010baf30c1 +[CCNode node] + 33
5 com.lasthaven.wordshufflemac 0x000000010bacb11b +[GameScene scene] + 62 (GameScene.m:32)
6 com.lasthaven.wordshufflemac 0x000000010bac9f90 -[MenuScene playGame:] + 363 (MenuScene.m:301)
7 com.lasthaven.wordshufflemac 0x000000010baee7e3 -[CCMenu ccMouseUp:] + 112
8 com.lasthaven.wordshufflemac 0x000000010bb177fb -[CCEventDispatcher mouseUp:] + 101
9 com.apple.Foundation 0x00007fff97fa5220 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 212
10 com.apple.Foundation 0x00007fff97fdf8b9 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] + 122
11 com.lasthaven.wordshufflemac 0x000000010bb17f25 -[CCEventDispatcher dispatchEvent:] + 140
12 com.apple.Foundation 0x00007fff97fab677 __NSThreadPerformPerform + 225
13 com.apple.CoreFoundation 0x00007fff8bee4101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 com.apple.CoreFoundation 0x00007fff8bee3a25 __CFRunLoopDoSources0 + 245
15 com.apple.CoreFoundation 0x00007fff8bf06dc5 __CFRunLoopRun + 789
16 com.apple.CoreFoundation 0x00007fff8bf066b2 CFRunLoopRunSpecific + 290
17 com.apple.Foundation 0x00007fff97fb389e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268
18 com.lasthaven.wordshufflemac 0x000000010bb16888 -[CCDirectorDisplayLink getFrameForTime:] + 162
19 com.apple.CoreVideo 0x00007fff8c0c603d CVDisplayLink::performIO(CVTimeStamp*) + 203
20 com.apple.CoreVideo 0x00007fff8c0c52a4 CVDisplayLink::runIOThread() + 632
21 com.apple.CoreVideo 0x00007fff8c0c5013 startIOThread(void*) + 148
22 libsystem_c.dylib 0x00007fff8ce13742 _pthread_start + 327
23 libsystem_c.dylib 0x00007fff8ce00181 thread_start + 13
scratch that.
after staring at this line for hours:
0 com.lasthaven.wordshufflemac 0x000000010bacc52a -[GameScene scrambleWord:] + 158 (GameScene.m:322)
I realized that the code consisted of a for loop and I couldn't figure out what was wrong with it! So in the end I forgot to initialize the int i in beginning of the for loop.
for(int i = 0; i < [word length]; i++ {
}
So for something so simple that caused a crash outside of XCode but not within it drove me nuts!
Thanks for reading!