Home How to modify code/DLL to work with IL2CPP
Reply: 0

How to modify code/DLL to work with IL2CPP

Valerie Published in 2017-11-14 23:26:29Z

I'm trying to modify a free Unity asset so that it will work with IL2CPP. This is the scripting backend for mono/Unity which supports 64 bit; required by Apple for any iTunes app. I'm up to the challenge, and I know any problems which I can't solve can be asked here, so I'd like to ask first if this is possible...

Starting with an empty/clean Unity 5.5.1f1 project for the iOS platform, I add (import) a DLL from this asset which allows me to call some native iOS popups. When tested on a device, and clicking the first button, which calls UIAlertView, an exception occurs. This happens when the application is built with scripting backend set to IL2CPP. When compiled with Mono2x as the backend, the app runs perfectly. Test device is iPhone 6+ running iOS 10. I want to see if I can work through the problems and use this asset.

According to the GitHub description this plugin is "...completely supported under AOT" (IL2CPP).

iOS4Unity is a Unity plugin that finally brings native iOS APIs to C# using only managed code -- with no Objective-C libraries involved! iOS4Unity takes advantage of the core C functions that comprise the building blocks of Objective-C to expose native iOS APIs to C#. iOS4Unity also provides native callbacks to C# without using UnitySendMessage that is completed supported under AOT!

I don't need any code, I just would like to know which direction I should go with breaking this down and solving. There are visual studio projects as part of the GitHub download. I guess my first question is, do I need to start with the custom DLL or is it just a matter of fixing the c#/Unity code?

The error from Xcode when clicking on the first button (Alert View) is: (sorry about the formatting)

2017-11-14 10:44:27.545397-0700 ProductName[8215:2832175] * NSForwarding: warning: selector (0x17001cde0) for message 'alloc' does not match selector known to Objective C runtime (0x192f87c6c)-- abort 2017-11-14 10:44:27.545560-0700 ProductName[8215:2832175] +[UIAlertView alloc]: unrecognized selector sent to class 0x1b26273c0 2017-11-14 10:44:27.642588-0700 ProductName[8215:2832175] Uncaught exception: NSInvalidArgumentException: +[UIAlertView alloc]: unrecognized selector sent to class 0x1b26273c0 ( 0 CoreFoundation 0x000000018c31aff0 + 148 1 libobjc.A.dylib 0x000000018ad7c538 objc_exception_throw + 56 2 CoreFoundation 0x000000018c321e34 + 0 3 CoreFoundation 0x000000018c31ef4c + 916 4 CoreFoundation 0x000000018c21ad2c _CF_forwarding_prep_0 + 92 5 ProductName 0x00000001001cd6c8 ObjC_MessageSendIntPtr_m341636550 + 144 6 ProductName 0x00000001001cced8 NSObject__ctor_m3196774225 + 100 7 ProductName 0x00000001001d1ed0 UIAlertView__ctor_m3092359446 + 92 8 ProductName 0x0000000100042ebc iOS4UnityExamples_UIAlertViewExample_m2883633377 + 220 9 ProductName 0x00000001001a026c InvokableCallList_Invoke_m1839244635 + 232 10 ProductName 0x000000010032eb64 ExecuteEvents_Execute_TisIl2CppObject_m4168308247_gshared + 868 11 ProductName 0x000000010015d254 StandaloneInputModule_ProcessTouchPress_m774618611 + 960 12 ProductName 0x000000010015ce04 StandaloneInputModule_ProcessTouchEvents_m3610522827 + 232 13 ProductName 0x000000010015c7b0 StandaloneInputModule_Process_m2811362425 + 76 14 ProductName 0x0000000100378968 _Z31RuntimeInvoker_Void_t1841601450PK10MethodInfoPvPS2_ + 28 15 ProductName 0x0000000100af05b0 _ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException + 68 16 ProductName 0x00000001007118fc _ZN19ScriptingInvocation6InvokeEPP15Il2CppExceptionb + 96 17 ProductName 0x000000010085cde4 _ZN13MonoBehaviour16CallUpdateMethodEi + 220 18 ProductName 0x00000001004f59a0 _ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv + 80 19 ProductName 0x00000001004f5924 _ZN16BehaviourManager6UpdateEv + 64 20 ProductName 0x000000010064ac4c _Z10PlayerLoopv + 752 21 ProductName 0x00000001008b795c _ZL19UnityPlayerLoopImplb + 32 22 ProductName 0x000000010002eb0c UnityRepaint + 140 23 ProductName 0x000000010002ea08 -[UnityAppController(Rendering) repaintDisplayLink] + 88 24 GPUToolsCore 0x00000001027144fc -[DYDisplayLinkInterposer forwardDisplayLinkCallback:] + 176 25 QuartzCore 0x000000018f52a600 + 44 26 QuartzCore 0x000000018f52a4b0 + 436 27 IOKit 0x000000018c587dd4 IODispatchCalloutFromCFMessage + 372 28 CoreFoundation 0x000000018c2b1958 + 180 29 CoreFoundation 0x000000018c2c9adc + 56 30 CoreFoundation 0x000000018c2c927c + 436 31 CoreFoundation 0x000000018c2c6d90 + 1752 32 CoreFoundation 0x000000018c1f6d94 CFRunLoopRunSpecific + 424 33 GraphicsServices 0x000000018dc60074 GSEventRunModal + 100 34 UIKit 0x00000001924af130 UIApplicationMain + 208 35 ProductName 0x00000001000289bc main + 156 36 libdyld.dylib 0x000000018b20559c + 4 ) 2017-11-14 10:44:27.646113-0700 ProductName[8215:2832175] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIAlertView alloc]: unrecognized selector sent to class 0x1b26273c0' *** First throw call stack: (0x18c31afd8 0x18ad7c538 0x18c321e34 0x18c31ef4c 0x18c21ad2c 0x1001cd6c8 0x1001cced8 0x1001d1ed0 0x100042ebc 0x1001a026c 0x10032eb64 0x10015d254 0x10015ce04 0x10015c7b0 0x100378968 0x100af05b0 0x1007118fc 0x10085cde4 0x1004f59a0 0x1004f5924 0x10064ac4c 0x1008b795c 0x10002eb0c 0x10002ea08 0x1027144fc 0x18f52a600 0x18f52a4b0 0x18c587dd4 0x18c2b1958 0x18c2c9adc 0x18c2c927c 0x18c2c6d90 0x18c1f6d94 0x18dc60074 0x1924af130 0x1000289bc 0x18b20559c) libc++abi.dylib: terminating with uncaught exception of type NSException

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.295644 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO