Closed jan-happy closed 1 year ago
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:
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);
};
}, []);
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.
@rbruels That helped in my case too. Thank you! Will close this issue now because it seems a bug with the OS.
@rbruels comment implies to me that the bug is in this package, not the OS?
@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.
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.
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!
Thanks for re-opening @jan-happy :)
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.
@gavrichards You resolve this problem? Or you have maps application?
@EpsWeb No I'm not able to solve this problem. I was hoping the maintainers of would look into this.
This is still a problem, does anyone have a workaround or a solution? are the maintainers looking into it?
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.
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 :)
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?
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
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?
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?
ITS COMING 💡
@birkir can you give an update please?
The scenedelegate is already here: https://github.com/birkir/react-native-carplay/pull/85
@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).
@birkir Can you suggest how to use with AppDelegate.m? still awaiting for your update.
@gavrichards Did you solve with AppDelegate.m?
@gavrichards Did you solve with AppDelegate.m?
No, we switched to the new version that uses a Swift AppDelegate and Scene delegates: https://github.com/birkir/react-native-carplay/issues/68#issuecomment-1227095299
I've flipped over to the Swift version as well.
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!