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

[QUESTION] App crashes when activated on CarPlay simulator, complaining about missing scene delegate #68

Closed
jan-happy opened this issue Oct 11, 2021 · 26 comments

Comments

@jan-happy
Copy link

Hi,
I'm using 2.0.0 with RN 0.64.2 and Xcode 13 to test on the iOS 15 simulator.
I'm fairly sure I've implemented everything according to the sample app, entitlement is present and I do nothing fancy but displaying a "Hello World" screen.
Still the app crashes as soon as I tab the app icon in the CarPlay simulator:
'NSGenericException', reason: 'Application does not implement CarPlay template application lifecycle methods in its scene delegate.'

I already looked into implementing the needed delegate but I wonder why it runs without all this in the example app in the first place.
Thanks for any hints!

@gavrichards
Copy link

I'm also experiencing this exact same issue, and cannot figure out a way around it.
React Native 0.66.0
Xcode 13
iOS 15 simulator

This is what appears in Xcode:
Xcode

In my code I have:

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

  useEffect(() => {
    function onConnect() {
      console.log('CarPlay Connected!');
      setCarPlayConnected(true);
    }

    function onDisconnect() {
      console.log('CarPlay Disconnected!');
      setCarPlayConnected(false);
    }

    // register connect and disconnect callbacks
    CarPlay.registerOnConnect(onConnect);
    CarPlay.registerOnDisconnect(onDisconnect);

    return () => {
      // unregister the callbacks in the return statement
      CarPlay.unregisterOnConnect(onConnect);
      CarPlay.unregisterOnDisconnect(onDisconnect);
    };
  }, []);

@rbruels
Copy link

rbruels commented Oct 20, 2021

It was revealed in another issue that this is because react-native-carplay requires the com.apple.developer.carplay-maps entitlement, even if you’re not using Maps. It’s definitely a bug.

@jan-happy
Copy link
Author

jan-happy commented Oct 20, 2021

@rbruels That helped in my case too. Thank you!
Will close this issue now because it seems a bug with the OS.

@gavrichards
Copy link

@rbruels comment implies to me that the bug is in this package, not the OS?

@rbruels
Copy link

rbruels commented Oct 20, 2021

@gavrichards It’s unclear at this point. I think a good test would be to see if the app works on device and without the Maps entitlement. If it does, it’s probably a simulator bug. If it doesn’t I’d imagine it’s a react-native-carplay bug.

What I know is that it won’t fly with Apple if you have a Maps entitlement for an app that doesn’t use Maps. So I hope it’s solvable. I’m going to try unlinking MapKit from the library (and removing the maps functionality obviously) and see if that “solves” it.

@gavrichards
Copy link

It’s unclear at this point. I think a good test would be to see if the app works on device and without the Maps entitlement.

It does. But then I don't have a CarPlay display connected.

The problem occurs in the simulator only when I also open the CarPlay simulator and tap the app's icon on there.

What I know is that it won’t fly with Apple if you have a Maps entitlement for an app that doesn’t use Maps.

Yeah that doesn't surprise me, and I don't want to have to request a maps entitlement that I'm not going to use anyway.

@gavrichards
Copy link

Would any of the maintainers / contributors be able to investigate further why it appears that this package requires the com.apple.developer.carplay-maps entitlement even when you're not using Maps? This seems like a fairly critical flaw, and is preventing me from being able to use the package. Thanks!

@jan-happy jan-happy reopened this Nov 8, 2021
@gavrichards
Copy link

Thanks for re-opening @jan-happy :)

@EpsWeb
Copy link

EpsWeb commented Nov 29, 2021

Hi there. I have same issue. It's also works also with maps entitlement, but it's not. So it will be cause problem on publishing, as I understand. So how to resolve it' anybody understood? Thanks in advance.

@EpsWeb
Copy link

EpsWeb commented Nov 30, 2021

@gavrichards You resolve this problem? Or you have maps application?

@gavrichards
Copy link

@EpsWeb No I'm not able to solve this problem. I was hoping the maintainers of would look into this.

@rimonnassory
Copy link

This is still a problem, does anyone have a workaround or a solution? are the maintainers looking into it?

@gavrichards
Copy link

I wish I knew. I've asked the question lots, here and on the Discord too, but I can't seem to get an answer. We're very keen to use this package but we're unable to until it works for apps without maps.

@rimonnassory
Copy link

I wish I knew. I've asked the question lots, here and on the Discord too, but I can't seem to get an answer. We're very keen to use this package but we're unable to until it works for apps without maps.

Thanks for the answer :)

@tomdye
Copy link
Collaborator

tomdye commented Feb 10, 2022

I'm afraid I don't know the solution to this off of the top of my head and do not have much in the way of spare time to look into it right now. Even if I did, my knowledge of the underlying native ios part of this code is limited. @birkir do you have any plans to look into this or any ideas as to what is going wrong here?

I'm aware that some people are having issues with loading the carplay simulator on M1 based macs regardless of the application type, but I believe this is a separate issue.

Can someone post a repo in which this issue is easily reproducible?

@kennyham
Copy link

The problem is that if you are doing something like an audio app (or almost anything other than a maps app), then you need to support the newer scene delegate . This example code doesn't do this and that's why it is crashing: https://developer.apple.com/documentation/carplay/displaying_content_in_carplay

@rimonnassory
Copy link

The problem is that if you are doing something like an audio app (or almost anything other than a maps app), then you need to support the newer scene delegate . This example code doesn't do this and that's why it is crashing: https://developer.apple.com/documentation/carplay/displaying_content_in_carplay

So, the only thing we can do is wait for a fix for this library?

@gavrichards
Copy link

The problem is that if you are doing something like an audio app (or almost anything other than a maps app), then you need to support the newer scene delegate . This example code doesn't do this and that's why it is crashing: https://developer.apple.com/documentation/carplay/displaying_content_in_carplay

@kennyham is this something you know how to fix?

@birkir
Copy link
Owner

birkir commented Mar 22, 2022

ITS COMING 💡

@gavrichards
Copy link

@birkir can you give an update please?

@birkir
Copy link
Owner

birkir commented Aug 25, 2022

The scenedelegate is already here: #85

@birkir birkir closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2023
@birkir birkir closed this as completed May 25, 2023
@fivecar
Copy link

fivecar commented Jun 1, 2023

@birkir : Is it possible to use ^2.3.0 with a classic AppDelegate.m somehow? When doing so, I hit this crash. However, I don't want to switch over to an AppDelegate.swift for the same reasons that @gavrichards mentioned in #132 (e.g. wanting Siri and other launchOptions).

@ElangoPrince
Copy link

@birkir Can you suggest how to use with AppDelegate.m? still awaiting for your update.

@ElangoPrince
Copy link

@gavrichards Did you solve with AppDelegate.m?

@gavrichards
Copy link

@gavrichards Did you solve with AppDelegate.m?

No, we switched to the new version that uses a Swift AppDelegate and Scene delegates: #68 (comment)

@fivecar
Copy link

fivecar commented Sep 4, 2024

I've flipped over to the Swift version as well.

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

10 participants