Good day everyone,
I am in the process of creating an iOS app for iPhone/iPod/iPad using Titanium SDK 3.1.1GA and using iOS 6.1 SDK and Xcode 4.6.3.
I am at my wits end trying to figure out why the app is randomly crashing on physical device but runs fine in the simulator. This especially happens when I open or close the same window at different times.
The module returns a window and inside the module I add labels, views, buttons, a listView, videoPlayer and related event handlers.
I open the window through a tableView click event listener like this:
tableView.addEventListener('click',function(e) { userDownloadWindowObj = new UserDownloadWindow(); userDownloadWindowObj.open({modal: true}); userDownloadWindowObj.addEventListener('close', function(e) { cleanUserDownloadWindow(); }); }); function cleanUserDownloadWindow() { userDownloadWindowObj = null; }And when I close the window, I have a button that listens to click event
/** * Event: Closing window and clean up */ doneButton.addEventListener('click', function(e) { Ti.App.idleTimerDisabled = false; clearInterval(interval); videoPlayer.stop(); videoPlayer.release(); win.close(); });From what I read, the exception related to memory management. It is trying to access objects in memory that have been already released or something along that line. But I am not sure how I can write code so that it prevents this from happening.
Does anyone have any tips in avoiding this?
Below is a re-symbolicated crash log. Thread 0 crashes at same points, just the memory address is different.
Incident Identifier: 01B3057A-A171-4279-AA2D-02ED966C0D90 CrashReporter Key: 4bb65be56495aeb9a0da56d387813bfcc5af932a Hardware Model: iPod4,1 Process: AVAPP [2215] Path: /var/mobile/Applications/D7E94FE7-E471-4F12-AE46-65917A0244BD/AVAPP.app/AVAPP Identifier: AVAPP Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1] Date/Time: 2013-06-21 21:35:00.464 -0400 OS Version: iOS 6.1.3 (10B329) Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x80000010 Crashed Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libobjc.A.dylib 0x3aa19f2a objc_release + 10 1 libsystem_blocks.dylib 0x3ae61ab0 _Block_release + 220 2 AVAPP 0x001810fe __destroy_helper_block_ (TiBase.m:271) 3 libsystem_blocks.dylib 0x3ae61ab0 _Block_release + 220 4 AVAPP 0x0018129c TiThreadProcessPendingMainThreadBlocks (TiBase.m:358) 5 libdispatch.dylib 0x3ae3411c _dispatch_call_block_and_release + 8 6 libdispatch.dylib 0x3ae334b4 _dispatch_client_callout + 20 7 libdispatch.dylib 0x3ae34dc6 _dispatch_main_queue_callback_4CF$VARIANT$up + 222 8 CoreFoundation 0x32d71f36 __CFRunLoopRun + 1286 9 CoreFoundation 0x32ce4eb8 CFRunLoopRunSpecific + 352 10 CoreFoundation 0x32ce4d44 CFRunLoopRunInMode + 100 11 GraphicsServices 0x368972e6 GSEventRunModal + 70 12 UIKit 0x34bfa2fc UIApplicationMain + 1116 13 AVAPP 0x000f77aa main (main.m:36) 14 AVAPP 0x000f630c 0xf4000 + 8972Same exception log at different time
Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libobjc.A.dylib 0x3aa19f2a objc_release + 10 1 libsystem_blocks.dylib 0x3ae61ab0 _Block_release + 220 2 AVAPP 0x0013b0fe __destroy_helper_block_ (TiBase.m:271) 3 libsystem_blocks.dylib 0x3ae61ab0 _Block_release + 220 4 AVAPP 0x0013b29c TiThreadProcessPendingMainThreadBlocks (TiBase.m:358) 5 libdispatch.dylib 0x3ae3411c _dispatch_call_block_and_release + 8 6 libdispatch.dylib 0x3ae334b4 _dispatch_client_callout + 20 7 libdispatch.dylib 0x3ae34dc6 _dispatch_main_queue_callback_4CF$VARIANT$up + 222 8 CoreFoundation 0x32d71f36 __CFRunLoopRun + 1286 9 CoreFoundation 0x32ce4eb8 CFRunLoopRunSpecific + 352 10 CoreFoundation 0x32ce4d44 CFRunLoopRunInMode + 100 11 GraphicsServices 0x368972e6 GSEventRunModal + 70 12 UIKit 0x34bfa2fc UIApplicationMain + 1116 13 AVAPP 0x000b17aa main (main.m:36) 14 AVAPP 0x000b030c 0xae000 + 8972