1

How can I do the configuration between React Native 0.60.0 and react-native-carplay?

I'm following example from https://www.npmjs.com/package/react-native-carplay but I'm receiving error on Xcode. I think that is fault of the changes of new version.
I would like use current version. Can someone help me?

Adding #import #import <RNCarPlay.h> on AppDelegate.m
Error => 'RNCarPlay.h' file not found

Adding methods before @end

  • (void)application:(UIApplication *)application didConnectCarInterfaceController:(CPInterfaceController *)interfaceController toWindow:(CPWindow *)window { [RNCarPlay connectWithInterfaceController:interfaceController window:window]; }

  • (void)application:(nonnull UIApplication *)application didDisconnectCarInterfaceController:(nonnull CPInterfaceController *)interfaceController fromWindow:(nonnull CPWindow *)window { [RNCarPlay disconnect]; }

Error => Use of undeclared identifier 'RNCarPlay'

import { CarPlay, GridTemplate } from 'react-native-carplay';

const template = new GridTemplate({ /* .. */ });

CarPlay.setRootTemplate(template, false);
Michael H.
  • 3,323
  • 2
  • 23
  • 31

1 Answers1

0

So I discovered some things ... Some steps didn't described on documentation.

In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]

Go to node_modules ➜ react-native-carply and add SplashScreen.xcodeproj

In XCode, in the project navigator, select your project. Add libSplashScreen.a to your project's Build Phases ➜ Link Binary With Libraries

To fix 'RNSplashScreen.h' file not found, you have to select your project → Build Settings → Search Paths → Header Search Paths to add:

$(SRCROOT)/../node_modules/react-native-carplay/ios

After this change the error is resolved.