I have a location service based tracking and geofencing app which would run for days and weeks in the background on and iOS 12.2 ff device.
Now with iOS 13.2 the app gets terminated after a variable amount of time, but at least several hours, due to excessive cpu usage:
Date/Time: 2019-11-09 23:25:18 +0200
End time: 2019-11-09 23:26:06 +0200
OS Version: iPhone OS 13.2 (Build 17B84)
Architecture: arm64
Report Version: 29
Incident Identifier: 5B46660C-A347-477F-8AE2-B1401080892B
Data Source: Microstackshots
Shared Cache: 0x44db8000 94FD24C8-F407-3A82-8D27-367F5B6C7BEC
Command: Anchorwatch
Path: /private/var/containers/Bundle/Application/32CD03B2-449C-4E84-8E06-79FA9B50F3A9/Anchorwatch.app/Anchorwatch
Identifier: de.sioned.Anchorwatch
Version: 2.2.1 (14)
Beta Identifier: 68A95EFC-B341-476C-9277-D711242471EC
PID: 57424
Event: cpu usage
Action taken: Process killed
CPU: 48 seconds cpu time over 48 seconds (99% cpu average), exceeding limit of 80% cpu over 60 seconds
CPU limit: 48s
Limit duration: 60s
CPU used: 48s
CPU duration: 48s
Duration: 48.39s
Duration Sampled: 14.08s
Steps: 16
Hardware model: iPad6,12
Active cpus: 2
Heaviest stack for the target process:
16 ??? (libsystem_pthread.dylib + 49032) [0x1c4f64f88]
16 ??? (libdispatch.dylib + 74516) [0x1c4ecb314]
16 ??? (libdispatch.dylib + 36344) [0x1c4ec1df8]
16 ??? (libdispatch.dylib + 33488) [0x1c4ec12d0]
16 ??? (libdispatch.dylib + 104312) [0x1c4ed2778]
16 ??? (libdispatch.dylib + 33948) [0x1c4ec149c]
16 ??? (libdispatch.dylib + 124996) [0x1c4ed7844]
16 ??? (libdispatch.dylib + 125216) [0x1c4ed7920]
16 ??? (libsystem_kernel.dylib + 158196) [0x1c50419f4]
Powerstats for: Anchorwatch [57424]
Bundle ID: de.sioned.Anchorwatch
Adam ID: 0
Is first party: No
App version: 2.2.1
Build version: 14
Is Beta: No
Share with Devs: No
UUID: 1C943425-70F9-3670-98D0-45D3051B4BB7
Path: /private/var/containers/Bundle/Application/32CD03B2-449C-4E84-8E06-79FA9B50F3A9/Anchorwatch.app/Anchorwatch
Architecture: arm64
Footprint: 1046.66 MB
Start time: 2019-11-09 23:25:52 +0200
End time: 2019-11-09 23:26:06 +0200
Num samples: 16 (100%)
CPU Time: 13.971s
Primary state: 15 samples Non-Frontmost App, Non-Suppressed, Kernel mode, Effective Thread QoS Background, Requested Thread QoS Default, Override Thread QoS Unspecified
User Activity: 0 samples Idle, 0 samples Active, 16 samples Unknown
Power Source: 0 samples on Battery, 0 samples on AC, 16 samples Unknown
16 _pthread_wqthread + 275 (libsystem_pthread.dylib + 49032) [0x1c4f64f88]
16 _dispatch_workloop_worker_thread + 587 (libdispatch.dylib + 74516) [0x1c4ecb314]
16 _dispatch_lane_invoke$VARIANT$mp + 419 (libdispatch.dylib + 36344) [0x1c4ec1df8]
16 _dispatch_lane_serial_drain$VARIANT$mp + 299 (libdispatch.dylib + 33488) [0x1c4ec12d0]
16 _dispatch_mach_invoke$VARIANT$mp + 471 (libdispatch.dylib + 104312) [0x1c4ed2778]
16 _dispatch_lane_serial_drain$VARIANT$mp + 759 (libdispatch.dylib + 33948) [0x1c4ec149c]
16 _dispatch_event_loop_drain$VARIANT$mp + 315 (libdispatch.dylib + 124996) [0x1c4ed7844]
16 _dispatch_kq_drain + 123 (libdispatch.dylib + 125216) [0x1c4ed7920]
16 kevent_id + 8 (libsystem_kernel.dylib + 158196) [0x1c50419f4]
1 <User mode>
Binary Images:
0x102d80000 - ??? Anchorwatch <1C943425-70F9-3670-98D0-45D3051B4BB7> /private/var/containers/Bundle/Application/32CD03B2-449C-4E84-8E06-79FA9B50F3A9/Anchorwatch.app/Anchorwatch
0x1c4eb9000 - 0x1c4f2dfff libdispatch.dylib <B7EED4C7-560D-3DA6-9B50-ED52A150AAC6> /usr/lib/system/libdispatch.dylib
0x1c4f59000 - 0x1c4f69fff libsystem_pthread.dylib <F8B082D8-24D9-3B1E-B80B-645FC8A88E14> /usr/lib/system/libsystem_pthread.dylib
0x1c501b000 - 0x1c5048fff libsystem_kernel.dylib <AE4C3D7A-7D08-33E7-BCC6-11AC821B4E48> /usr/lib/system/libsystem_kernel.dylib
While in background the app does nothing more than to write each location update to a sqlite database and checking the current location against a safety perimeter.
There is no reason to assume that the app suddenly after several hours would require such a high cpu usage.
I have not the slightest idea how to approach the problem and I am not even sure if I can do anything about it or if it is a bug in 13.2 and I have to wait for a fix.
My first assumption was, that the old iOS 12.0 bug which terminated background apps without reason and which was fixed in 12.2 was back. But that here seems to be something new. I was able to run the test app iOS 12 terminates apps in the background for no reason for several days.
Any hint how to interprete the log and take action ?
Edit:
It seems, that this is related to iOS 13.2 message: nehelper sent invalid result code [1] for Wi-Fi information request
Location service queries the WiFi interface in second intervals. Instrument shows that these query calls have a memory leak.
Turning off WiFi on the device seems to solve the problem, though that is no true solution. Now waiting for iOS 13.3 to leave beta.
It turned out, that a third party framework that I am using launches calls to CNCopyNetworkInfo in second intervals. These calls could not fullfilled as my App had no WiFi capabilities enabled and thus the calls to CNCopyNetworkInfo caused small memory leaks that added up over time.
After enabling WiFi access capabilities the memory leaks vanished.
Related
Our app received the crash multi times due to use Pasteboard. Under this situation when I try to use system Notes paste the content, the system notes will block too. So I write a program try to read the pasteboard, but it will also crash when I use [UIPasteboard generalPasteboard].
I'm sure this seriou bug is apple's bug, all the app will crash when launch under this situation If use UIPasteboard class. When I reboot the phone, it's ok. I have report this issue to apple but no reply, very disappointed.
Date/Time: 2018-12-19 11:37:49.4053 +0800
Launch Time: 2018-12-19 11:37:29.3603 +0800
OS Version: iPhone OS 12.1 (16B92)
Baseband Version: 3.11.00
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d
Termination Description: SPRINGBOARD, scene-create watchdog transgression: com.xxxxx.xxxx exhausted real (wall clock) time allowance of 19.86 seconds | ProcessVisibility: Background | ProcessState: Running | WatchdogEvent: scene-create | WatchdogVisibility: Foreground | WatchdogCPUStatistics: ( | "Elapsed total CPU time (seconds): 14.230 (user 14.230, system 0.000), 18% CPU", | "Elapsed application CPU time (seconds): 0.005, 0% CPU" | )
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.UIKit.pasteboard.cache-queue
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001eb35bed0 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001eb35b3a8 mach_msg + 72
2 libdispatch.dylib 0x00000001eb1db614 _dispatch_mach_send_and_wait_for_reply + 500
3 libdispatch.dylib 0x00000001eb1dbab4 dispatch_mach_send_with_result_and_wait_for_reply$VARIANT$armv81 + 56
4 libxpc.dylib 0x00000001eb422eb4 xpc_connection_send_message_with_reply_sync + 204
5 Foundation 0x00000001ec393a28 __NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY__ + 12
6 Foundation 0x00000001ec15b4dc -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 3632
7 CoreFoundation 0x00000001eb7d5460 ___forwarding___ + 556
8 CoreFoundation 0x00000001eb7d745c _CF_forwarding_prep_0 + 92
9 Pasteboard 0x0000000200c29778 -[PBServerConnection pasteboardWithName:createIfNeeded:error:] + 688
10 Pasteboard 0x0000000200c2949c -[PBServerConnection pasteboardWithName:error:] + 96
11 UIKitCore 0x00000002187b5d90 _pasteboardCacheQueue_existingItemCollectionWithName + 896
12 UIKitCore 0x00000002187b57d8 __59+[_UIConcretePasteboard _pasteboardNamed:createIfNotFound:]_block_invoke + 228
13 libdispatch.dylib 0x00000001eb20a484 _dispatch_client_callout + 16
14 libdispatch.dylib 0x00000001eb1ea754 _dispatch_lane_barrier_sync_invoke_and_complete + 56
15 UIKitCore 0x00000002187b5630 +[_UIConcretePasteboard _pasteboardNamed:createIfNotFound:] + 332
16 UIKitCore 0x00000002187b4b00 +[UIPasteboard _pasteboardWithName:create:] + 148
I had a similar issue with a search bar (in different view controllers).
Quit the ios simulator and launch it again, it helps me.
My react native app is crashing when launched outside of Xcode with the following exception showing up in the crash report on the device logs for thread 0.
Incident Identifier: DB5E0F81-977F-44B0-BD8B-FAAF33F98119
CrashReporter Key: e3b8d0751b47b37db0d7d6fcc5dde46051f8d30c
Hardware Model: iPhone7,1
Process: crashTest [388]
Path: /var/mobile/Containers/Bundle/Application/CE56E818-7288-4A39-8220-16E17158C916/crashTest.app/crashTest
Identifier: org.reactjs.native.example.crashTest
Version: 1 (1.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2017-04-25 12:42:30.30 -0400
Launch Time: 2017-04-25 12:42:10.10 -0400
OS Version: iOS 9.1 (13B143)
Report Version: 105
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Exception Note: SIMULATED (this is NOT a crash)
Highlighted by Thread: 0
Application Specific Information:
org.reactjs.native.example.crashTest failed to scene-create after 19.92s (launch took 0.08s of total time limit 20.00s)
Elapsed total CPU time (seconds): 9.230 (user 9.230, system 0.000), 23% CPU
Elapsed application CPU time (seconds): 0.113, 0% CPU
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x0000000199ff0a7c semaphore_wait_trap + 8
1 libdispatch.dylib 0x0000000199ece614 _dispatch_semaphore_wait_slow + 244
2 CFNetwork 0x0000000184246ac0 CFURLConnectionSendSynchronousRequest + 288
3 CFNetwork 0x000000018426a07c +[NSURLConnection sendSynchronousRequest:returningResponse:error:] + 120
4 crashTest 0x0000000100128858 -[RCTBundleURLProvider isPackagerRunning:] (RCTBundleURLProvider.m:76)
5 crashTest 0x0000000100128b00 -[RCTBundleURLProvider guessPackagerHost] (RCTBundleURLProvider.m:92)
6 crashTest 0x0000000100128d10 -[RCTBundleURLProvider packagerServerHost] (RCTBundleURLProvider.m:106)
7 crashTest 0x0000000100128ed4 -[RCTBundleURLProvider jsBundleURLForBundleRoot:fallbackResource:] (RCTBundleURLProvider.m:123)
8 crashTest 0x000000010006a8cc -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:21)
9 UIKit 0x000000018a0f5324 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400
10 UIKit 0x000000018a323acc -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2904
11 UIKit 0x000000018a327e0c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1656
12 UIKit 0x000000018a324f50 -[UIApplication workspaceDidEndTransaction:] + 168
13 FrontBoardServices 0x000000018e90b7c4 -[FBSSerialQueue _performNext] + 184
14 FrontBoardServices 0x000000018e90bb44 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
15 CoreFoundation 0x0000000184aa4544 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
16 CoreFoundation 0x0000000184aa3fd8 __CFRunLoopDoSources0 + 540
17 CoreFoundation 0x0000000184aa1cd8 __CFRunLoopRun + 724
18 CoreFoundation 0x00000001849d0ca0 CFRunLoopRunSpecific + 384
19 UIKit 0x000000018a0ee1c8 -[UIApplication _run] + 460
20 UIKit 0x000000018a0e8ffc UIApplicationMain + 204
21 crashTest 0x000000010006ad08 main (main.m:16)
22 libdyld.dylib 0x0000000199eee8b8 start + 4
I understand that my app is taking too long to launch and display. If I run directly from Xcode with my device tethered there are no issues (but it does take forever to launch)
I am testing this with the default react project produced with react-native init
When I build the project in Xcode I see the following warning:
[tid:com.facebook.react.JavaScript][RCTModuleData.mm:220] RCTBridge required dispatch_sync to load RCTDevSettings. This may lead to deadlocks
I am new to react-native, and I am assuming maybe this is running in some sort of dev mode that does not allow me to launch the app when un-tethered or on a different network? Are there special instructions I am missing that I need to follow when building the app to run independently on the device without having to archive the app in Xcode?
Check if you're connected to the same WiFi network. Just had this.
In your -[AppDelegate application:didFinishLaunchingWithOptions:] function you're kicking off a synchronous network request, and that request appears to be taking too long. iOS kills your app because it has failed to finish launching (specifically, it's failed to return from application:didFinishLaunchingWithOptions:) after 20 seconds.
I've run into the same issue, and don't have a solution, but a temporary workaround that helped me. I've posted it here - https://github.com/facebook/react-native/issues/10187 in the hopes that someone better versed with objective-c and url loading will take a look and put in the proper fix. Hope this helps. Thanks.
The issue, as Aaron Golden has pointed out, is that a synchronous request is made from the main thread at load time in order to figure out whether the react packager (remote server running on the same network) is accessible. This can take awhile for reasons beyond my knowledge (if someone can expound on this, I'd be grateful), but apple will crash the app if this takes longer than 19 seconds (approx).
I'm getting a crash periodically with a gpus_ReturnGuiltyForHardwareRestart.
The crash is sporadic, and occurs in a complex multi-threaded app. Sample stack trace below.
It seems to occur (which is rare) when the UI and related handlers are being stressed (think hyperactive user making lots of gestures as quickly as the app and system will allow), with lots of resulting calls to behind-the-scenes and up-front rendering.
Researching gpus_ReturnGuiltyForHardwareRestart suggests this may be due to a buffer issue, e.g. a buffer overrun due to an incorect binding or failure to unbind.
gpus_ReturnGuiltyForHardwareRestart crash
(not relevant, but I did look: gpus_ReturnGuiltyForHardwareRestart)
My understanding is that a buffer gets corrupted in some way, and the crash happens sometime later when the corrupted buffer is accessed.
I've been through the code and made sure every bound buffer and texture is subsequently unbound to prevent unwanted/unintentional changes by later code; still getting the crash.
I did just come across these, suggesting the possibility of a bug in the OS:
iOS 9 Beta 4 crash: gpus_ReturnGuiltyForHardwareRestart (original poster indicated was fixed in 9 beta 5)
Re: OpenGLES driver crash in iOS9 Beta2/3
However, I'm currently testing on 9.3.4, so it seems this would be fixed.I've tried making sure all buffers are properly unbound after use, and tried periodic use of glFlush(), both without success.
Does anybody have experience with this, any knowledge on potential sources, means of tracking down causes, or fixes?
Stack trace:
Date/Time: 2016-08-11T20:20:40Z
Launch Time: 2016-08-11T20:15:22Z
OS Version: iPhone OS 9.3.4 (13G35)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x1
Crashed Thread: 0
Thread 0 Crashed:
0 libGPUSupportMercury.dylib 0x0000000191bd9f28 gpus_ReturnGuiltyForHardwareRestart + 12
1 libGPUSupportMercury.dylib 0x0000000191bdaec4 gpusSubmitDataBuffers + 168
2 GLEngine 0x0000000195e9f1e4 gliPresentViewES_Exec + 172
3 GLEngine 0x0000000195e9f0fc gliPresentViewES + 80
4 OpenGLES 0x000000018576bc44 -[EAGLContext presentRenderbuffer:] + 68
5 NWFPApp 0x00000001001ef8fc -[NWFPIOSGLView renderNormalBuffers] (NWFPIOSGLView.mm:543)
6 NWFPApp 0x00000001001ef814 -[NWFPIOSGLView renderAll] (NWFPIOSGLView.mm:516)
7 NWFPApp 0x00000001001ee780 -[NWFPIOSGLView doInContext:] (NWFPIOSGLView.mm:135)
8 NWFPApp 0x00000001001ef770 -[NWFPIOSGLView drawView] (NWFPIOSGLView.mm:494)
9 NWFPApp 0x0000000100203cc8 -[NWFPGLChoreographer displayLinkEvent:] (NWFPGLChoreographer.m:128)
10 QuartzCore 0x000000018614022c CA::Display::DisplayLinkItem::dispatch() + 36
11 QuartzCore 0x00000001861400e0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 420
12 IOKit 0x0000000183885e54 IODispatchCalloutFromCFMessage + 368
13 CoreFoundation 0x00000001835ad030 __CFMachPortPerform + 176
14 CoreFoundation 0x00000001835c57d4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
15 CoreFoundation 0x00000001835c4f0c __CFRunLoopDoSource1 + 432
16 CoreFoundation 0x00000001835c2c64 __CFRunLoopRun + 1796
17 CoreFoundation 0x00000001834ecc50 CFRunLoopRunSpecific + 380
18 GraphicsServices 0x0000000184dd4088 GSEventRunModal + 176
19 UIKit 0x00000001887ce088 UIApplicationMain + 200
20 NWFPApp 0x00000001002af1a0 main (main.m:30)
21 ??? 0x000000018308a8b8 0x0 + 0
We're having a weird crash inside libdispatch internal functions and after hours and hour of research we have no clue about what's happening.
The crash trace is:
Incident Identifier: 7A5CBCD8-28A3-4AC5-937A-D5BA69A64B67
CrashReporter Key: [TODO]
Hardware Model: iPhone5,2
Process: Memoir Dev [6973]
Path: /Users/USER/Memoir Dev.app/Memoir Dev
Identifier: com.veri.memoir-enterprise
Version: 0.9.191
Code Type: ARM
Parent Process: launchd [1]
Date/Time: 2013-03-03 20:55:42 +0000
OS Version: iPhone OS 6.1.2 (10B146)
Report Version: 104
Exception Type: SIGABRT
Exception Codes: #0 at 0x3ae66350
Crashed Thread: 1
Thread 0:
0 libsystem_kernel.dylib 0x3ae55e30 _mach_msg_trap + 20
1 CoreFoundation 0x000972bb __CFRunLoopServiceMachPort + 131
2 CoreFoundation 0x00095fdb __CFRunLoopRun + 819
3 CoreFoundation 0x32bc823d _CFRunLoopRunSpecific + 357
4 CoreFoundation 0x32bc80c9 _CFRunLoopRunInMode + 105
5 GraphicsServices 0x367a633b _GSEventRunModal + 75
6 UIKit 0x34ae42b9 _UIApplicationMain + 1121
7 Memoir Dev 0x0002a0d7 main (main.m:20)
Thread 1 Crashed:
0 libsystem_kernel.dylib 0x3ae66350 ___pthread_kill + 8
1 libsystem_c.dylib 0x3ae1936b _abort + 95
2 libsystem_c.dylib 0x3adb212d _free + 361
3 libdispatch.dylib 0x000088d1 _dispatch_kevent_register + 169
4 libdispatch.dylib 0x00007e91 _dispatch_source_kevent_register + 33
5 libdispatch.dylib 0x00008957 _dispatch_timer_list_update + 27
6 libdispatch.dylib 0x00006b81 _dispatch_mgr_invoke + 389
7 libdispatch.dylib 0x00002378 _dispatch_mgr_thread + 36
Thread 2:
0 libsystem_kernel.dylib 0x3ae55e30 _mach_msg_trap + 20
[...]
A bit of background about our code and scenario:
We're using extensively NSOperations and GCD to upload data to our server
The crash seems to happen when the app is uploading in background, within the 10 minutes limit
The crash started to happen around feb/9 using iOS 6.1 (10B143), just few days after we upgrade from 6.0.2 to 6.1
Until now we can reproduce it in iOS 6.1.2 (10B146) but don't in 6.0.1 (10A523)
Regarding SIGABRT exception type, it seems someone is calling 'abort' function (indeed, it's 'free' called by 'dispatch_kevent_register')
Does any of you know if there's any known issue inside GCD in iOS 6.1 and later?
This is free() aborting due to heap corruption in the process.
The dispatch manager thread being the one to hit the abort() is likely incidental (the backtrace indicates it woke up to asynchronously install a new dispatch timer source and malloc detected the corruption at that time).
You may want to try running with GuardMalloc (see Diagnostics tab in XCode scheme editor), it is more likely to give you a crashpoint when the corruption actually occurs.
Alternatively the various malloc debug environment variables may help track down the culprit, c.f. ENVIRONMENT in malloc(3)
My application is crashing when one of the views is purged from memory because of low-memory condition. At least this is what I understand from the crashlog. It happens on numerous screens but only when opening a Facebook dialog (using the Facebook SDK). Basically, looks like the system sometimes runs out of memory when we need to present a Facebook dialog (e.g. to let user post something on the Facebook timeline).
Date/Time: 2012-03-14 19:47:33.819 +0000
OS Version: iPhone OS 5.1 (9B176)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x30000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x30f2bf78 objc_msgSend + 16
1 MyApp 0x00003c0e -LTBaseViewController viewDidUnload (LTBaseViewController.m:145)
2 MyApp 0x00004ea2 -LTBaseTableViewController viewDidUnload (LTBaseTableViewController.m:90)
3 UIKit 0x33766bd8 -[UIViewController unloadViewForced:] + 244
4 UIKit 0x338ae492 -[UIViewController purgeMemoryForReason:] + 58
5 Foundation 0x3071a4f8 __57-NSNotificationCenter addObserver:selector:name:object:_block_invoke_0 + 12
6 CoreFoundation 0x30e95540 ___CFXNotificationPost_block_invoke_0 + 64
7 CoreFoundation 0x30e21090 _CFXNotificationPost + 1400
8 Foundation 0x3068e3e4 -NSNotificationCenter postNotificationName:object:userInfo: + 60
9 Foundation 0x3068fc14 -NSNotificationCenter postNotificationName:object: + 24
10 UIKit 0x3387926a -UIApplication _performMemoryWarning + 74
11 UIKit 0x33879364 -UIApplication _receivedMemoryNotification + 168
12 libdispatch.dylib 0x36a12252 _dispatch_source_invoke + 510
13 libdispatch.dylib 0x36a0fb1e _dispatch_queue_invoke$VARIANT$up + 42
14 libdispatch.dylib 0x36a0fe64 _dispatch_main_queue_callback_4CF$VARIANT$up + 152
15 CoreFoundation 0x30e9c2a6 __CFRunLoopRun + 1262
16 CoreFoundation 0x30e1f49e CFRunLoopRunSpecific + 294
17 CoreFoundation 0x30e1f366 CFRunLoopRunInMode + 98
18 GraphicsServices 0x33fb6432 GSEventRunModal + 130
19 UIKit 0x336f5e76 UIApplicationMain + 1074
20 MyApp 0x00004818 main (main.m:16)
21 MyApp 0x000023b4 0x1000 + 5044
I checked and there are almost no memory leaks, e.g. when testing the app for an hour the total memory leaked was around 2-3Kb caused by some string-copying libraries. So I don't believe this is caused by the application. I guess that when the phone is not restarted for some time there are applications running in the background and when using Facebook SDK the memory becomes a problem and the system tries to recover the memory from random applications, including my application.
My question is, how can I prevent this crash from happening? How should I handle unloadViewForced on a view controller to make the app more robust in low-memory conditions? And lastly, am I right that this crashlog suggests the crash occurred because the system tried to free memory and my application didn't handle it properly?
Any help greatly appreciated.
What is most likely happening is that one of the objects being referred to and probably being released by LTBaseViewController viewDidUnload method is being doubly released. In fact, since the backtrace indicates that the crash is happing on line 145 of LTBaseViewController.m you should be able to quickly see which object is the culprit.