Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CarPlay.onConnect not producing any result #150

Closed
shubhadeep-foodhub opened this issue Oct 19, 2023 · 7 comments
Closed

CarPlay.onConnect not producing any result #150

shubhadeep-foodhub opened this issue Oct 19, 2023 · 7 comments

Comments

@shubhadeep-foodhub
Copy link

shubhadeep-foodhub commented Oct 19, 2023

I am trying to test the possibility of this library in our existing app.

as we are still supporting iOS 13, I am trying to use the 1.3.1 version of this library and following the steps written in the readme and examples associated with it. for testing, I am using iPhone 15 simulator and car play simulator. but in the below code, CarPlay.onConnect is not producing any results and the app is not showing in the simulator. can anyone please let me know what I am doing wrong?

useEffect(() => {
        const helloWorld = new GridTemplate({
          buttons: [],
          title: 'Hello world',
        });
    
        CarPlay.onConnect(() => {
          console.log('connected to carplay');
        })
        CarPlay.onDisconnect(() => {
          console.log('disconnected to carplay');
        })
    
        CarPlay.setRootTemplate(helloWorld);
      }, []);
@elieT27
Copy link

elieT27 commented Oct 20, 2023

I am experiencing the same issue, I am myself using the the latest version of you library. I followed the readme, but without any result, I am not seeing my app in the simulator and I cannot connect to carPlay. Any clue ?

@shubhadeep-foodhub
Copy link
Author

I am not able to find any solutions till now. can anyone help with some proper/latest steps? @birkir @DanielKuhn

@DanielKuhn
Copy link
Contributor

DanielKuhn commented Oct 26, 2023

I don't have any experience with older versions of this package, so I'm unable to help here.
Using the current example works fine for me:

const [carPlayConnected, setCarPlayConnected] = useState(CarPlay.connected);

useEffect(() => {
  function onConnect() {
    setCarPlayConnected(true);
  }

  function onDisconnect() {
    setCarPlayConnected(false);
  }

  CarPlay.registerOnConnect(onConnect);
  CarPlay.registerOnDisconnect(onDisconnect);

  return () => {
    CarPlay.unregisterOnConnect(onConnect);
    CarPlay.unregisterOnDisconnect(onDisconnect);
  };
});

@shubhadeep-foodhub
Copy link
Author

@DanielKuhn Thanks for the reply. Can you please let me know whether I test this using a carplay simulator and an iPhone simulator as I don't have an iPhone. Are there any other steps other than the readme? actually, the app is not showing on the carplay simulator.

@DanielKuhn
Copy link
Contributor

@shubhadeep-foodhub run your app on Simulator.app, open a CarPlay window (via I/O > External Displays) and launch the app there. Once the app opens on CarPlay the onConnect method is called.
If your app doesn't show up at all in the CarPlay window, then you probably haven't set an entitlement in Xcode, indicating that your app supports CarPlay.

@shubhadeep-foodhub
Copy link
Author

@DanielKuhn Thank you for the support. The App is running properly after setting the proper path in Code Signing Entitlements.

@claus-lysholm
Copy link

Aahh, will try the Entitlements tip and then update my posted issue 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants