App Crashes on iOS 12

Hello!

My app is crashing on iOS 12. On other versions (i.e. 15, 17), we could not reproduce it. The problem occurs every once in a while. It simply crashes after a few seconds using the App.

I got a crash report and will include in the post. Looks like Language exception crash , but i could not narrow it down to the cause of the problem. The crash happens under the "suggestd" name. Appreciate if someone can help.

Here is the symbolicated crash report.

Thanks for the post.

It seems like the app is running in the background and gets terminated after the timeout.

Thread 3 name:  Dispatch queue: com.apple.root.background-qos
Thread 3 Crashed:
0   libsystem_kernel.dylib        	0x00000001f68ee0dc __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001f6967094 pthread_kill$VARIANT$mp + 380
2   libsystem_c.dylib             	0x00000001f6846ea8 abort + 140
3   libc++abi.dylib               	0x00000001f5f13788 __cxa_bad_cast + 0
4   libc++abi.dylib               	0x00000001f5f13934 default_unexpected_handler+ 6452 () + 0
5   libobjc.A.dylib               	0x00000001f5f2ae00 _objc_terminate+ 24064 () + 124
6   libc++abi.dylib               	0x00000001f5f1f838 std::__terminate(void (*)+ 55352 ()) + 16
7   libc++abi.dylib               	0x00000001f5f1f8c4 std::terminate+ 55492 () + 84
8   libdispatch.dylib             	0x00000001f67907e8 _dispatch_client_callout + 36
9   libdispatch.dylib             	0x00000001f6741164 _dispatch_root_queue_drain + 680
10  libdispatch.dylib             	0x00000001f67418d4 _dispatch_worker_thread2 + 128
11  libsystem_pthread.dylib       	0x00000001f69711b4 _pthread_wqthread + 464
12  libsystem_pthread.dylib       	0x00000001f6973cd4 start_wqthread + 4
  • The crash occurs on Thread 3, which is running in the background (Dispatch queue: com.apple.root.background-qos).
  • The pthread_kill function is being called, which forcefully terminates the thread.
  • This termination leads to a series of unwind calls, ultimately resulting in the _objc_terminate function, indicating that the entire app is being terminated.

Possible Reason for Termination: The app is likely being terminated after the specified background execution time limit has been exceeded. iOS has strict guidelines for background app usage to preserve battery life and system resources.

Recommendation: To prevent background terminations, you should optimize your app's background tasks to complete within the allowed time limit. Here are some general tips:

  1. Reduce Background Activity: Minimize the number of tasks your app performs in the background.
  2. Use Background Execution Modes Appropriately: Understand and use the correct background execution modes provided by iOS, such as .location, .fetch, .audio, etc.
  3. Background Fetch Optimization: If you use .fetch mode, ensure your app fetches data efficiently and minimizes the time it takes to complete.
  4. Inspect Background Task Logs: Use Xcode's "Debug Navigator" to inspect your app's background task logs and identify any tasks that may be taking too long.

Additional Resource: Every iOS version may handle background timeouts a little differently.

For more detailed information on reducing background terminations and optimizing background performance, refer to the documentation:

https://developer.apple.com/documentation/xcode/reduce-terminations-in-your-app#Background-termination-reasons

I’ve been consulting with my colleague about your issue and I want to clarify something. They wrote:

It seems like the app is running in the background and gets terminated after the timeout.

That’s not right. As you surmised, that backtrace indicates an unhandled language exception. The doc you reference has good advice on how to debug this when the exception in is your app. However, that’s not the case here. Both crash reports you posted are from suggestd, which is an Apple system process.

Do you have any specific evidence that these suggestd crashes are related to your app? For example, do the timestamps in the crash reports match the times that the app crashed? If not, I suspect that these crashes are a red herring, and there’s something else causing problems for your app.

You wrote:

My app is crashing on iOS 12. On other versions (i.e. 15, 17), we could not reproduce it.

Does that mean you can reproduce it on iOS 12? Or that your customers are reporting the problem but only on iOS 12?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I’ve been consulting with my colleague about your issue and I want to clarify something. They wrote:

It seems like the app is running in the background and gets terminated after the timeout.

That’s not right. As you surmised, that backtrace indicates an unhandled language exception. The doc you reference has good advice on how to debug this when the exception in is your app. However, that’s not the case here. Both crash reports you posted are from suggestd, which is an Apple system process.

Do you have any specific evidence that these suggestd crashes are related to your app? For example, do the timestamps in the crash reports match the times that the app crashed? If not, I suspect that these crashes are a red herring, and there’s something else causing problems for your app.

You wrote:

My app is crashing on iOS 12. On other versions (i.e. 15, 17), we could not reproduce it.

Does that mean you can reproduce it on iOS 12? Or that your customers are reporting the problem but only on iOS 12?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hello!

Initially, this issue was reported by a customer on his iPad with iOS 12.5.7. Then, I was able to reproduce a crash on the same iOS 12.5.7 while debugging (i got an iPad with iOS 12.5.7, because XCode 15 does not support the iOS 12 simulator runtimes).

On both scenarios, my app is the only one among other installed apps that crashes abnormally (it gets really slow and then crashes after a few seconds of use). I can't confirm that my app is the cause, but checking the crash reports, there is always a new .ips file under the name of "suggestd" with the same timestamp of the crash.

Also, sometimes another .ips file is created with a name of "log-sessions" and has a couple more informations... It mentions my app's bundle id, version, a bug_type 179 and the same timestamp as the suggestd crash report. Don't know if it is related, but these are the investigations I've done so far.

App Crashes on iOS 12
 
 
Q