swift-unity icon indicating copy to clipboard operation
swift-unity copied to clipboard

Unity 2018 il2cpp issues

Open vvodicka opened this issue 6 years ago • 13 comments

Hi, I am trying this with Unity 2018.3/ XCode 10.1 and I am getting a lots of errors similar to this one: https://github.com/jiulongw/swift-unity/issues/31

For example: No member named 'ParseAssemblyName' in 'il2cpp::icalls::mscorlib::System::Reflection::AssemblyName' No member named 'UnsafeGetValue' in 'il2cpp::icalls::mscorlib::System::Reflection::FieldInfo' No member named 'PropertyInfo' in namespace 'il2cpp::icalls::mscorlib::System::Reflection'; did you mean simply 'PropertyInfo'? etc...

I also needed to fix some include paths like #include "Classes/Unity/UnitySharedDecls.h" to #include "../Classes/Unity/UnitySharedDecls.h" according to your folder structure.

When building project in Unity, I use scripting runtime version .NET 4.* Equivalent, since 3.5 is deprecated.

Am I doing something wrong?

vvodicka avatar Jan 19 '19 14:01 vvodicka

You can try: https://github.com/jiulongw/swift-unity/pull/120

jenthone avatar Jan 22 '19 08:01 jenthone

Hi, did you find a solution? I stuck in the same place...

Arkania9 avatar Jan 23 '19 09:01 Arkania9

@Arkania9 Did you try this? https://github.com/jiulongw/swift-unity/issues/119#issuecomment-456306381

jenthone avatar Jan 23 '19 09:01 jenthone

@jenthone thank you so much, it worked! Cheers

Arkania9 avatar Jan 23 '19 10:01 Arkania9

I remove the file as suggested in #120 But still get the same error (clean and restart Xcode) I am using Unity 2018.3.4

Any idea @jenthone @Arkania9 ?

ghus86 avatar Feb 07 '19 15:02 ghus86

Hi, did you remove files or only reference from the project? In my case removing references was enough.

Arkania9 avatar Feb 07 '19 16:02 Arkania9

Ok thanks first only reference then deleted the files =/

ghus86 avatar Feb 07 '19 17:02 ghus86

Where are the files?

uditmukherjee avatar Mar 14 '19 13:03 uditmukherjee

Build Error :No member named 'Contexts' in namespace 'il2cpp::icalls::mscorlib::System::Runtime::Remoting' on Xcode 10.2 and Unity 2018.3.121.

User11101989 avatar Apr 18 '19 09:04 User11101989

I have fixed this issue by appending "-DNET_4_0" to the OTHER_CFLAGS in Unity.xcconfing file.

see this for more info : https://github.com/jiulongw/swift-unity/issues/31

Soorya-S avatar Jun 24 '19 07:06 Soorya-S

I also needed to go through this process so I put all required steps you guys mentioned together. Thanks a bunch for solving these issues. Hope it helps :).

Using Unity 2019.1.7f1 and build with Xcode 10.3

Note: Do a Clean Build Folder and in Xcode if you want to Rebuilding!!!

---- Step 1 ----

When error: _Undefined symbol: OBJC_CLASS$AVPlayerViewController

Xcode <Your Project File> → Target/<Your Target>/General/Linked Frameworks and Libraries → add AVKit.framework

---- Step 2 ----

When error: 'Classes/iPhone_Sensors.h' file not found

→ in DynamicLibEngineAPI.mm

change:

#include Classes/iPhone_Sensors.h

to:

#include iPhone_Sensors.h

---- Step 3 ----

→ in Unity.xcconfig

Appending -DNET_4_0 to the OTHER_CFLAGS in Unity.xcconfig file (also mentioned in a comment in this file).

source: https://github.com/jiulongw/swift-unity/issues/119#issuecomment-504901522

---- Step 4 ----

Please delete reference of: DynamicLibEngineAPI-functions.h && DynamicLibEngineAPI.mm from xcode projectif this error occur (can be about 100 errors):Undefined symbols for architecture arm64:"_SetUnityiOS81orNewerBody", referenced from:_SetAllUnityFunctionsForDynamicPlayerLib in DynamicLibEngineAPI.o"_SetUnityiOS82orNewerBody", referenced from:_SetAllUnityFunctionsForDynamicPlayerLib in DynamicLibEngineAPI.o

source: https://github.com/jiulongw/swift-unity/pull/120#issuecomment-456315250

→ search in Xcode project for:

#include DynamicLibEngineAPI-functions.h

and comment out or delete all #include directives that reference this file.

most calls are → in DynamicLibEngineAPI.mm

---- Step 5 ----

Clean Build Folder, Build Project

→ Error free :)

Bredj0 avatar Aug 13 '19 13:08 Bredj0

---- Step 6 ----

If you are using Vuforia (8.3.8 or similar) and having VuforiaWrapper not found error then add "$(PRODUCT_NAME)/Unity/Libraries/com.ptc.vuforia.engine/Vuforia/Plugins/iOS" to the LIBRARY_SEARCH_PATHS in Unity.xcconfig file

divyeshmakwana96 avatar Oct 11 '19 20:10 divyeshmakwana96

@RichardAchilles for step 2, you can achieve the same by adding a build phase before Unity Rsync to avoid editing:

sed -i '' 's+Classes/iPhone_Sensors.h+iPhone_Sensors.h+g' "$UNITY_IOS_EXPORT_PATH"/Classes/DynamicLibEngineAPI.mm

divyeshmakwana96 avatar Oct 11 '19 20:10 divyeshmakwana96