Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by JonCapri · Apr 28, 2020 at 01:41 PM · ioscrashxcode

[Unity 2019.2] iOS build crashes 5 seconds after the application is killed by the user


Description

he application presents a crash 2~5 seconds after it's terminated by the user (i.e. force kill the app). This happens only on iOS builds on multiple unity versions (see details below). Most of the crashes reports are not arriving on Crashlytics. There are very few crashes on the console, even though we're consistently reproducing this error on a daily basis. The Android builds don't present the same error.


Steps to reproduce

  1. Open the game

  2. Wait until the loading scene is about to finish or until the game scene is fully loaded

  3. Kill the application

  4. Wait 2~5 seconds and see the crash report window

  • Reproduction rate: 80%

  • Devices used to test: iPhone SE, iPhone 7, iPhone 8, iPad Mini 4

  • Also observed the crash on: iPhone XS, iPhone XR


    Additional information

  • The issue is iOS specific. We have the same build on Android working without issues.

  • Crash reports are not being captured by Crashlytics on most cases (see some of the crashes below).

  • Crashes happen only on the final steps of the loading, where the external SDKs are being initialized.

  • On TestFlight, the crash count is 0 for almost all builds, including the ones the users are reporting the crashes.

  • Using a debug button that calls the Application.Quit() method of Unity doesn't cause the application to crash, even though it takes a while to close.

  • The crash seems to be invariante to OS version and iOS device.


    Technical information

  • Unity version: 2019.2.17f1. Also reproduced with 2019.2.0f1 and 2019.3.10f1.

  • External plugins are listed here.

  • Crash reports
    • GUID.cpp line 108

    • libc++abi.dylib

    • String.h line 195

    • AudioToolbox


      Explorations

Here's a list of all solution attempts without success so far:

  • Remove GameAnalytics plugin

  • Remove IronSource plugin

  • Remove UnityIAP plugin

  • Workaround on PostProcess iOS

  • Set minimum OS version to 9.0

  • Comment all OnApplicationPause/Quit implementations (plugins included)

  • Enable Bitcode

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by JonCapri · Apr 28, 2020 at 02:18 PM


Solution


Description: The general problem is to have any piece of code that blocks the Main Thread on iOS when the application is finalizing (see this document for more information). In our case it is happening because of ongoing requests when the player kills the application. As we save the player progress on the server when the application is terminated (using Dispose() method), the request blocked the main thread, causing the crash. The solution is to remove this particular save. We tested a build including this fix and, so far, we have no crashes on 20 attempts of killing the game after the Game Scene is loaded. We haven't thought about this before because this piece of code is there since August of 2019 and it hasn't been touched since then. The problem started to happen only in February of 2020.


More information: Since the piece of problematic code was in the project since August of 2019 and the problem started to happen only on February of 2020, it's possible that the iOS version has something to do with it. We haven't investigate the changelog yet, but the oldest iOS version presenting the crash so far is iOS 13.2, released on October 28th, 2019.

Another possibility is that some change on our backend code caused the request to hang. As we use BestHTTP, by default all requests are aborted when the application is terminated. We haven't investigate if the execution order of Dispose vs. OnDisable/OnApplicationQuit can be the issue. Also, by default, the requests aborted by BestHTTP during Application Quit still call the callbacks. In our case, the callback for that Save Player is null, so this might not be the problem.


Related crashes: We're still facing some crashes on the loading scene. As far as we've seen, they happen when there's a request going on. The reproduction rate of those issues are way lower than the problem on Game Scene.


Hints: We had difficulty to retrieve the logs on Crashlytics, because most of them weren't being send. Here's a step-by-step of how to retrieve the log from the iOS device itself:

  • Open the Settings app on your iPhone/iPad device

  • Go to Privacy (appears below Battery on iOS 13)

  • Scroll to the bottom and open Analytics & Improvements

  • Open Analytics Data

  • Find the logs for the desired application

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Aseemy · May 11, 2020 at 08:04 AM 0
Share

the link provided is invalid. i have edited the link by removing unnecessary characters. kindly update it : https://developer.apple.com/library/archive/qa/qa1693/_index.html

avatar image
0

Answer by Haze-Games · Sep 22, 2020 at 02:06 AM

Same issue here. I think you're right about the main thread issue, but it looks like a Unity bug. I'm saying this, because the issue happens if you exit the game right after starting the app, when you're still in the splashscreen; no game code executed yet, and the crash still happens. Whatever I can do to prevent it in other scene, still happens in splashscreen.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

243 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 5.4 crash after iOS version building and open xcode8 0 Answers

ios app crashes on start 0 Answers

Using "Dynamic" Keyword 3 Answers

Xcode - Mach-O Linker Error after upgrade to Unity 2019.4 (LTS) 0 Answers

iOs build fails on 5.3 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges