iOS app crash on start with IL2CPP(64bit) setting, sql problem

Im using Unity 5.52f1, when I try to submit my app to app store,
an error message say the app must be a 64bit one, I go back to Unity
Changed Scripting Backend from Mono2x to IL2CPP, no problem in unity
after build it with xcode and test it on any iOS devices, my app crash on start
Android experiences no problem

I get the following message in the Xcode log
"project01 was compiled with optimization - stepping may behave oddly; variables may not be available.

This is what I get in Xcode

This is my settings in Unity

And heres the sql plugin I am using

The app works fine under the following settings

I have tried not to run anything with sql, nothing went wrong
The app only crash with sql script running

Thank you

The code in il2cpp::vm::Exception::Raise means that a manage exception is occurring. I suspect that this issue is related to managed code stripping, where the IL2CPP build toolchain removes managed code that is not being used from assemblies.

For IL2CPP, managed code stripping is enabled by default, for Mono it is not. That might explain the difference in behavior.

You can disable managed code stripping with IL2CPP for various assemblies using the link.xml file. Please see the documentation here: Unity - Manual: Optimizing the size of the built iOS Player

Thank you for your reply

I have tried adding an xml file to disable code stripping, and the result is still the same
I get the same error message and my app still crashes with my sql script running

here is my xml file and settings in unity

Thanks again

Rather than preserving individual types, I would recommend preserving entire assemblies, like this:

You can add a line for each assembly in the project. This will ensure that stripping does not happen for these assemblies, and might work around the problem.

Ignoring individual types in a case like this can be difficult to get right.

Thank you again for the reply

I tried preserving in xml like this

This time I have a different result, When I hit build in run in unity
I got the following errors

everything works fine if I just press play in Unity, but I cannot finish the build and test on an iOS device,
and Xcode pop up and gives me the following messages


Many thanks

As the error mentions, there seems to be no assembly for System.Data.SqlClient in the project. Should there be a file named System.Data.SqlClient.dll? Maybe the name is slightly wrong in the link.xml file.

Thanks for the advice again,

I have tried a lot of different ways to fix it, still no luck on solving it.
I started a new project with nothing but only the sql line just to connect the server

Like this

my app crashes when the sql line runs,
one more strange thing is that if the login information is wrong, my app wont crash,
although it cannot get what it should get from the server

and the xml file

Thank you

So does the app build on run on the device now? If so, that is at least an improvement, as it was failing to build before. If so, what is the error or exception when the app crashes?

I get a very similar error in xcode as I get in the very beginning

I tested on my device, it crashes at the moment when sql line runs

This is a managed exception that occurs in the app. You may be able to debug it to determine the cause using techniques described in this blog post: https://blogs.unity3d.com/2015/05/20/il2cpp-internals-debugging-tips-for-generated-code/

Make sure that you build in Debug in Xcode, so that you will be able to see as much information as possible.