f111fei / react-native-unity-demo

103 stars 80 forks source link

'Classes/Unity/UnitySharedDecls.h' file not found in UnityExport->Classes->UI->SplashScreen.mm IOS #33

Closed GisliNielsen closed 5 years ago

GisliNielsen commented 5 years ago

Fresh React-Native-Unity-Demo project, unity version 2018.3.6f1

Looks like the path to the build is wrong as it finds it if I change it to "Unity/UnitySharedDecls.h", but changing it gives me 200 errors in xcode.

mikeyamato commented 5 years ago

Here's what I did to fix this issue with success.

As I looked further into this issue I saw the file UnitySharedDecls.h was within Classes/Unity/. So I went into the calling file, SplashScreen.mm (Classes/UI/), and updated the path to be #include "Unity/UnitySharedDecls.h". Screen Shot 2019-04-15 at 10 40 07 AM

The following error may happen to some. If not, just continue to the next step. 'Classes/iPhone_Sensors.h' file not found called by DynamicLibEngineAPI.mm. I went into DynamicLibEngineAPI.mm and updated the affecting line to be #include "iPhone_Sensors.h".

I wouldn't expect anything less if there wasn't another error. This time, Undefined symbol: _OBJC_CLASS_$_AVPlayerViewController. To fix this add the AVKit.framework.

There was one more hurdle that had to do with "Copy Data" (...file path.../ios/UnityExport/Data: No such file or directory). For this I deleted reference of the existing Data file and added in reference to the Data folder from the project. Screen Shot 2019-04-15 at 12 14 03 PM

Screen Shot 2019-04-15 at 12 30 22 PM

After all was said and done, build succeeded!

Hopefully this will help others trying to get the demo up and going on iOS.

My setup: SDK iOS: 12.2, Xcode: 10.2, react: 16.5.0, react-native: 0.57.0, react-native-unity-view: ^1.3.0