Search Issue Tracker

Won't Fix

Votes

96

Found in

2019.3.15f1

2019.4

2020.2

Issue ID

1262272

Regression

No

[iOS][UaaL] UnityFramework with 3rd party plugins triggers watchdog termination after launch

iOS

-

Reproduction steps:
1. Open project in "FirebaseTestMintegral.zip"
2. Build the project for iOS
3. Open .xcworkspace generated in the build folder
4. Deploy the Application to an iOS device
5. Shut the Application down (using Xcode or the device itself)
6. Open the Application from the device (without using Xcode)

Expected result: the Application will launch successfully
Actual result: the Application starts launching and shuts down in around 10-20 secs

Reproducible with: 2019.3.15f1, 2019.4.5f1, 2020.1.0f1, 2020.2.0a18
Could not test with 2018.4, 2019.3.0a1 because I was unable to resolve package/namespace errors

Devices tested:
Reproducible with:
VLNQA00310 iPad Pro 12.9 1st gen (iOS 13.4.1)
Not reproducible with:
VLNQA00204 iPhone 5C (iOS 10.3.3)
iPhone 7 iOS 12.3.
iPad 7th gen iOS 13.2.2
VLNQA00015, Samsung Galaxy Note8 (SM-N950W), Android 8.0.0, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540

---------------
Possible workaround:
By default UnityFramework.framework is embedded in Unity-iPhone target and it is not linked with it some plugins are sensitive to this initialization path. UnityFramework is loaded later at runtime.
* Go to Unity-iPhone / Build Phases / Link Binary with Libraries build section and add UnityFramework.framework.
UnityFramework will be loaded at the same time as the main executable.

  1. Resolution Note (2021.1.X):

    At some point, UnityFramework runtime together with plugins is loaded at run time by dyld/NSBundle.load. Please keep that in mind while developing a plugin.
    Any API-rich initialization on +(load), attribute(constructor), and global object construction code paths should be moved to a later phase preferably after UnityFramework is loaded, and even better when Unity is initialized.
    Simple plain data initialization is safe, but API-rich calls that deal with other os parts especially networking and user interface APIs might lead to deadlock leading to watchdog termination.
    By doing delayed/lazy initialization you can get better control over initialization order, you can reduce the application load time, and most importantly you avoid possible deadlock.

    ---------------
    Possible workaround:
    By default UnityFramework.framework is embedded in Unity-iPhone target and it is not linked with it, UnityFramework is loaded later at runtime and some plugins are sensitive to this initialization path.

    * Go to Unity-iPhone / Build Phases / Link Binary with Libraries build section and add UnityFramework.framework.
    UnityFramework will be loaded at the same time as the main executable.

Comments (32)

  1. pistoleta

    Nov 07, 2020 13:14

    Thanks Binouze, very useful

  2. BBO_Lagoon

    Nov 05, 2020 05:03

    Reproduced on unity 2020.1.11f1.
    I fixed the crash by adding UnityFramework.framework to the xCode project path using a postprocess build script.

    public class BuildProcessors : IPostprocessBuildWithReport
    {
    public void OnPostprocessBuild( BuildReport report )
    {
    #if UNITY_IOS
    if( report.summary.platform == BuildTarget.iOS )
    {
    var pathToBuiltProject = report.summary.outputPath;
    var projectPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
    var project = new PBXProject();
    project.ReadFromString(File.ReadAllText(projectPath));

    project.AddFrameworkToProject( project.GetUnityMainTargetGuid(), "UnityFramework.framework", false );
    project.WriteToFile( projectPath );
    }
    #endif
    }
    }

  3. pistoleta

    Nov 04, 2020 18:10

    I just found it the upgrading the iPhone XR from iOS 14.1 to 14.2 beta. I will try the workaround.

  4. TigerHix

    Oct 29, 2020 04:26

    Reproduced with Unity 2019.4.13f1, iOS 14.2 beta on iPhone 8 Plus. Can confirm the workaround does work.

    I have to agree with STUDENTVZ here - Unity has been absolutely doing disgrace to itself by focusing on so-called "next-gen console features for AAA games" while all other features are falling apart. This is not even an obscure bug, but it is literally crashing on launch - the most serious bug one can imagine, and it really takes the entire 2020 to fix it? Seriously?

  5. OneManEscapePlan

    Oct 29, 2020 00:50

    We found that this issue did not occur on an iPad Air 2 with iOS 11.4, but did occur after updating the iPad to iOS 14.1. The issue also occurs on an iPod Touch with iOS 14.1. The workaround seems to fix the issue.

  6. MikkelFredborg_LEGO

    Oct 13, 2020 12:29

    We have also experienced this issue on tvOS / AppleTV4K running iOS 13.4.8. Linking UnityFramework.framework directly in Unity-iPhone fixes the issue for us.

  7. Babybus_Study

    Oct 10, 2020 06:34

    Unity 2019.4.11f1 and Unity 2019.4.12f1 both said they fixed this issue, but unfortunately they didn't.

  8. studentvz

    Oct 09, 2020 14:00

    The issue was created on Jul 10, 2020, this bug is known on forums months before, and there is still no fix for this?

    All Unity version after February 2020 has this issue, people are losing users because of this. Yes, you can use older Unity, but then that Unity doesn't have other important fixes, for example, fix related to Storyboard that is mandatory since July 2020. What should we do?

    You can't fix this or give some workaround?

    What a shame. Unity is more and more disappointment, spending time on fancy new half-finished features that we can live without, but can't spend time to solve crucial bugs on platforms (mobile) that popularized Unity and it is keeping Unity alive.

  9. SamiSdd

    Oct 06, 2020 13:27

    A Question, does this workaround mention works?

  10. SamiSdd

    Oct 06, 2020 13:26

    I think this issue is underrated because most of the users would struggle with different crash logs and trying to figure out the issue

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.