f111fei / react-native-unity-demo

103 stars 80 forks source link

Native component for "UnityView" does not exist #5

Closed NathanBWaters closed 6 years ago

NathanBWaters commented 6 years ago

I ran the following commands: git clone https://github.com/f111fei/react-native-unity-demo cd react-native-unity-demo npm install react-native upgrade react-native link react-native-unity-view npm run watch npm run ios

When building with npm run ios I get the following error:

ld: warning: object file (~/code/rn_unity/ios/build/Build/Products/Debug-iphonesimulator/libRNUnityView.a(RNUnityViewManager.o)) was built for newer iOS version (11.2) than being linked (8.0)
ld: warning: object file (~/code/rn_unity/ios/build/Build/Products/Debug-iphonesimulator/libRNUnityView.a(UnityUtils.o)) was built for newer iOS version (11.2) than being linked (8.0)
ld: warning: object file (~/code/rn_unity/ios/build/Build/Products/Debug-iphonesimulator/libRNUnityView.a(RNUnityView.o)) was built for newer iOS version (11.2) than being linked (8.0)
Undefined symbols for architecture x86_64:
  "_GetAppController", referenced from:
      +[RNUnityViewManager handleAppStateDidChange:] in libRNUnityView.a(RNUnityViewManager.o)
      -[RNUnityViewManager setBridge:] in libRNUnityView.a(RNUnityViewManager.o)
      -[RNUnityView initWithFrame:] in libRNUnityView.a(RNUnityView.o)
  "_UnityInitRuntime", referenced from:
      _InitUnity in libRNUnityView.a(UnityUtils.o)
  "_UnitySendMessage", referenced from:
      _UnityPostMessage in libRNUnityView.a(UnityUtils.o)
  "RegisterFeatures()", referenced from:
      _InitUnity in libRNUnityView.a(UnityUtils.o)
  "RegisterMonoModules()", referenced from:
      _InitUnity in libRNUnityView.a(UnityUtils.o)
  "UnityInitTrampoline()", referenced from:
      _InitUnity in libRNUnityView.a(UnityUtils.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

And when the app comes up on the emulator I am seeing:

Invariant Violation: Native component for "UnityView" does not exist

I feel like I must be missing a step. Is it clear what I'm doing wrong?

For more information: npm = 6.0.0 node = v8.11.1 unity = 2017.4

f111fei commented 6 years ago
1. Open unity/Cube/Assets/test.unity

2. Click Build => Export Android or Export IOS

And See

Do not support emulator

https://github.com/f111fei/react-native-unity-demo/issues/3

NathanBWaters commented 6 years ago

Oh yes, I did do 1 and 2 as well, apologies. I'll try it out without an emulator. By the way, thanks for the fast response! Will keep you updated.

JuanFri commented 6 years ago

Hi guys, I have the same problem as NathanBWaters, build on Xcode connected to physical device fail with the same message. Any updates on this error?

Thanks

f111fei commented 6 years ago

@JuanFri Try remove UnityExport folder reference in Xcode and Build => Export IOS again.

JuanFri commented 6 years ago

Xcode 9.3 Unity 2017.2.0f3

  1. Download project

  2. Import Unity cube project in unity

  3. build for iOS

  4. import react native project in Xcode

  5. build generate this error: screen shot 2018-05-09 at 15 25 33

  6. Remove Unity export folder references from Xcode project

  7. In Unity, export cube project again for IOS

  8. No linker errors, build successful

Thanks guys

kevando commented 6 years ago

I ran into the same issue as @JuanFri and his #6 and #7 fixed it for me. Great demo, thanks! I look forward to exploring what we can make with this.

im-aditya commented 6 years ago

I am new to XCode.. so I am not sure how to 'Remove Unity export folder references from Xcode project' ??

Can someone please help me out. Thanks