# IOS library crashes in distribution configuration

**URL:** <https://forums.unrealengine.com/t/ios-library-crashes-in-distribution-configuration/2003237>\
**Category:** Mobile\
**Tags:** unreal-engine, crash, iOS, framework, CPP, question\
**Created:** [September 3, 2024, 10:33am UTC](https://forums.unrealengine.com/t/ios-library-crashes-in-distribution-configuration/2003237 "2024-09-03T10:33:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zaratusa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zaratusa](https://forums.unrealengine.com/u/Zaratusa)\
**Post date:** [September 3, 2024, 10:33am UTC](https://forums.unrealengine.com/t/ios-library-crashes-in-distribution-configuration/2003237/1 "2024-09-03T10:33:39Z")

</div>

Hi,

I’m currently adding the Android & IOS library to the `NNERuntimeORT` from `ue5-main` branch plugin. Android works fine in Development & Release, however IOS only works with non distribution builds, not in distribution builds. I’ve used the following code to include the framework to the plugin:

```c++
if (Target.Platform == UnrealTargetPlatform.IOS)
{
	PublicAdditionalFrameworks.Add(new Framework(
		"ONNXRuntime", 
		Path.Combine(PluginDirectory, "Binaries", "ThirdParty", "Onnxruntime", Target.Platform.ToString(), "onnxruntime.xcframework")
	));
}

```

I’ve tried various versions of onnxruntime: `1.14.0`, `1.14.1`, `1.19.1`. I even tried various download sources: `nuget`, `cocoa`, as well as `download.onnxruntime.ai`. All having the exact same behaviour.

Here is the stack trace:

 ![crash](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/2/7e201d4912089779f56831e0b43391015fd87801.png)

---

<div class="post-metadata">

**Author:** ![Zaratusa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zaratusa](https://forums.unrealengine.com/u/Zaratusa)\
**Post date:** [September 14, 2024, 11:34am UTC](https://forums.unrealengine.com/t/ios-library-crashes-in-distribution-configuration/2003237/2 "2024-09-14T11:34:15Z")

</div>

Here is an [minimal example project](https://drive.google.com/file/d/1zEB6nhafScv_qTvsSv4SNA_cZzB6nlGv/view) without anything else than the onnxruntime framework for iOS to reproduce the issue.

---

<div class="post-metadata">

**Author:** ![Nonlin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nonlin](https://forums.unrealengine.com/u/Nonlin)\
**Post date:** [November 23, 2024, 3:47am UTC](https://forums.unrealengine.com/t/ios-library-crashes-in-distribution-configuration/2003237/3 "2024-11-23T03:47:02Z")

</div>

Are you adding the framework correctly? I thought it was supposed to be added as the platform framework specifically not the entire xcframework folder?

---

<div class="post-metadata">

**Author:** ![Soham\_27](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soham\_27](https://forums.unrealengine.com/u/Soham_27)\
**Post date:** [June 1, 2025, 1:14pm UTC](https://forums.unrealengine.com/t/ios-library-crashes-in-distribution-configuration/2003237/4 "2025-06-01T13:14:30Z")

</div>

Hey! 👋

I’ve implemented a working fix for using `libonnxruntime` in iOS **distribution builds** with UE 5.4. It includes:

✅ Embedded `.xcframework` with `bForceEmbedded = true`  
✅ `FORCE_ANSI_ALLOCATOR=1` to avoid allocator crash  
✅ Preserved ONNX flags (`ORT_NO_EXCEPTIONS`, etc.)  
✅ README with full reproduction and patch steps

🔗 Download full working project here: [MinimalExample\_ONNX\_Fixed.zip](https://sandbox:/mnt/data/MinimalExample_ONNX_Fixed.zip)

Let me know if you’d like help testing or tweaking. Happy to support!
