简体   繁体   中英

Xamarin.iOS : Native Linking Error: Is there a limit on No. of files in IOS?

We are working on a large Xamarin.Forms project, the customer wanted Android release first, so we complete the entire Android project and delivered it, now when we have started working on IOS project, we are facing challenges as we keep adding more forms to the IOS project. Some of the errors are

Error # 1. Native linking error: don't know how to convert instruction ec7acce4 referencing _mono_create_corlib_exception_0.island to thumb in '# _object_System_Type_object_System_Globalization_CultureInfo' from /#.iOS/1db41bf625bf2eb66083739a668e7273/obj/iPhone/Debug/mtouch-cache/#.dll.armv7.o for architecture armv7 iOS

Error # 2. Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

Since we were not making any headway, we started creating a new Solution in Xamarin.forms and started adding one Form in each Android and IOS, it worked fine until a specific number of files count, after that we started getting the same errors again in IOS. the project works fine with about 867 files. (PCL - 638 files, ios - 107 files, Android - 122 files)

As soon as I add a new set of forms to PCL project, I get the above error #1, or Error # 2 in IOS project. The Android project works fine. There is no sequence of the error, any of the above error just comes up, after I reduce the file count, the error is gone

Is there a limitation to the number of Forms in IOS? or Is there any limitation on the binary size. As per my understanding, IOS allows up to 100 MB in binaries. My current IOS binary is about 55 MB

I am stuck and not able to find any solution till now. Have already tried upgrading/downgrading Xamarin.forms versions, but no help, currently on Xamarin.forms 2.3.4.224 Xamrin.ios 10.3.1.8 Xamarin.Android 7.0.2.42 Xamarin 4.2.2.11 visual studio 2015 Professional

Also tried compiling and opening the project on MAC, visual studio 2017 Professional, getting same error Also tried compiling on Xamarin studio on MAC, still getting same error.

It seems the native code Xamarin generates for one of your assemblies ends up hitting size limitations in the native (Mach-O) file format.

Solution:

One of the solution from similar cases is adding --mono:framework to the "Additional mtouch arguments" at iOS Platform->Properties->iOS Build.

Then the mono runtime will be included as a framework in the app, instead of linked statically into the main executable.

References:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM