Closed phil-andrews closed 5 years ago
Cross posted this to StackOverflow.
Have you installed the native dependencies with react-native link react-native-radar
?
Additionally - there looks to be some sort of a configuration problem since the native errors shown above would not compile - the malformed string literal in particular. Would you mind sharing your linked dependencies? (Found in Build Phases
-> Link Binary With Libraries
)
I have linked with react-native link react-native-radar
.
Mind also expanding that Libraries
directory in the left pane there? RNRadar.xcodeproj
should be in that list, otherwise there might be an issue with your header search paths.
Your header search paths may need to include $(SRCROOT)/../node_modules/react-native-radar/ios
if not already added. Or pointing to wherever your node_modules/react-native-radar/ios
module is located.
The node_module search paths are there under build settings. That's part of the mystery since we're calling the radar initialization code from AppDelegate. If it couldn't find the module I'd expect it to fail with a "can't find headers" error in iOS during the build. Instead the app builds fine up until I uncomment out Radar.whatever
in the RN js.
Yeah, this is very odd as that native could shouldn't even compile; the string literal in [Radar initializeWithPublishableKey:"key"]
should fail, should be [Radar initializeWithPublishableKey:@"key"]
. I've noticed that react native builds can fail but the toolchain still pushes an old version of the .app
to the simulator, its worth double checking that your build is succeeding.
However, that issue seems separate since your error is caught in the JS runtime. Normally this would mean the RNRadar
ios module isn't being linked and thus registered so no module is found at runtime. In your case, the linking appears to be happening so either the registration (with react native macros) isn't happening or possibly compilation in general (evidenced by the syntax error not being caught).
That was it. Showing my lack of Obj-C chops it was the @
. Funny that didn't fail. But alright, we're up and running now.
Happy that fixed it! Sorry about the confusion, the error messages from React Native sometimes are way off 😝
No worries, thanks for the help!
Describe the bug When running on the iOS emulator any Radar function produces a "NativeModules.RNRadar is undefined" error. I have followed the SDK instructions for iOS. I have not installed for Android.
The app, which is just the basic rn template app, runs fine until I call Radar.
To Reproduce Steps to reproduce the behavior:
App.tsx
incomponentDidMount
.Expected behavior Radar functions to be available.
Screenshots
Metadata (please complete the following information): "react-native": "0.57.8", "react-native-radar": "^2.1.2" emulator XR xCode 10
Update: In the Plist screenshot you'll see an empty string for one of the privacy settings. I put in a string and it didn't change anything.
The errors in
AppDelegate
don't have an effect at runtime.