iOS Crashing on UnityWebRequestAssetBundle.GetAssetBundle if ARCore Extensions included
Our published App stopped working on Monday seemingly out of nowhere. Before that we had no trouble, the published app was online for a couple of days and worked as expected.
I did some investigations that i go into more detail in my post to the Unity forums. (https://forum.unity.com/threads/ios-crashing-on-assetbundle-load.1509404/) I also created a Unity Bug Report since the crash happens on the Unity side. In short from my testing following criteria produce a crash:
- Call UnityWebRequestAssetBundle.GetAssetBundle(url).SendWebRequest(); with a valid url that hosts any unity built bundle.
- The project needs to contain following Pods:
platform :ios, '12.0'
target 'UnityFramework' do
pod 'ARCore/CloudAnchors', '~> 1.35.0'
pod 'ARCore/GARSession', '~> 1.35.0'
pod 'ARCore/Geospatial', '~> 1.35.0'
pod 'Firebase/Auth', '9.6.0'
pod 'Firebase/Core', '9.6.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static
It will crash once the bundle download finished.
I think the firebase pod is not necessary since the extensions already depend on it.
My testing config: Build on Macbook M1 XCode 15.0.1 <- might be important Target device: IpadOS 16.7.1 IPad Pro 12.9 4th Gen
In the Unity Forum linjianfei found a workaround. It is possible to add "-ld64" to the linker flags to circumvent the issue.
I had this issue too and the linker flag worked for me. Let me leave where to put the "-ld64" flag in Xcode. [Build Settings] > [UnityFramework] > [Other Linker Flags]
Thank you for finding the solution. It saved my life.
Xcode: 15.2 Unity: 2023.3.26f1 ARCore Extensions: 1.42.0 I'm using AR Foundation 5.1.4