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

car play emulator crashes/ not working #7

Closed
Niall-Kenny opened this issue Nov 30, 2021 · 15 comments · Fixed by #14
Closed

car play emulator crashes/ not working #7

Niall-Kenny opened this issue Nov 30, 2021 · 15 comments · Fixed by #14
Assignees
Labels
good first issue Good for newcomers in testing This issue has been testing

Comments

@Niall-Kenny
Copy link

Hi there,

I use an m1 macbook air and followed the instructions outlined on pub.dev and in this issue for setting up entitlements, your response was very useful! 🙂

This is the project I used when encountering the following errors:

  1. iphone app crashes when I open the carplay simulator
  2. carplay simulator displays grey screen when connected

1. iphone app crashes when I open the carplay simulator

Screen.Recording.2021-11-30.at.14.38.22.mov

repro steps:

  1. make sure carplay simulator is closed
  2. run flutter app
  3. open carplay simulator
  4. iphone app crashes

2. carplay simulator displays grey screen when connected

Screen.Recording.2021-11-30.at.14.40.54.mov

repro steps:

  1. make sure carplay simulator is open
  2. run flutter app
  3. open carplay app
  4. carplay app has grey screen

To note:
RunnerDebug.entitlements is used in this project, I did also try Runner.entitlements but with no effect.

@oguzhnatly
Copy link
Owner

oguzhnatly commented Dec 7, 2021

Hello, @Niall-Kenny. Thank you for reporting your concern about the bug!

While in debugging mode in Flutter or when a flutter hot reload is fired, it may not properly reload or set the current template from flutter cli to apple carplay and may show you a gray screen in the first carplay-iphone connection because no template has been set due to hot reload. Could you please re-run flutter start without any reload and see if the gray screen is still present in your current project when the simulator is connected to carplay simulator? If you want to use hot reload, try updating the root template. It is important to note that you must always use Runner.entitlements.

I hope it is helpful to you; please let me know if any other errors occur in your case.

@Niall-Kenny
Copy link
Author

Hi there, sorry for the late reply.

Since opening the app again I've been seeing errors like the following when trying the set the root template with list or tab bar components:
Screenshot 2022-02-07 at 14 57 32

@oguzhnatly
Copy link
Owner

oguzhnatly commented Feb 13, 2022

Hi @Niall-Kenny, it’s not a problem. Could you please update your project repository that you got this error? So that we can reproduce the error to fix it. Also make sure you’ve added the carplay entitlements.

@mastro993
Copy link

Same problem for me.
I followed the instructions and implemented the library in my app.
The app starts correctly but it crashes whenever I open the app on the CarPlay emulator.
Running with XCode I found that the cause of the problem is in the AppDelegate.swift that throws the following error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported object <CPTabBarTemplate: 0x6000004379f0> <identifier: B43041AD-9862-451C-BF67-FF0D57C5B8FE, userInfo: (null), tabTitle: (null), tabImage: (null), showsTabBadge: 0> passed to setRootTemplate:animated:completion:. Allowed classes: (null)'
terminating with uncaught exception of type NSException
CoreSimulator 783.5 - Device: iPhone 13 Pro Max (EDBB6254-C444-40C2-BD49-4D4646251821) - Runtime: iOS 15.2 (19C51) - DeviceType: iPhone 13 Pro Max
_LSContextInitReturningError() failed with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0xf6701f12 bb1a56bb bba5f39f 3f7801a6 ... f9fe6ee0 ef307d24 }, _LSLine=405, WrongSimulatorHash={length = 32, bytes = 0x9da4b2b1 56f7ac19 1a99bc21 b7ec95c2 ... c4004d14 03ef83dc }}

@EArminjon
Copy link

EArminjon commented Mar 5, 2022

@oguzhnatly it crash on start :/

I simply add all the content from https://github.com/oguzhnatly/flutter_carplay/blob/master/example/lib/main.dart to my app.
I edit my AppDelegate.swift as your doc said and create the sceneDelegate, updated podfile IOS to 14. My app well launch and didn't crash. When launching CarPlay, carplay crash and I got this log :

2022-03-05 14:18:54.123193+0100 Runner[62302:4633665] flutter: On carPlay connection change : connected
2022-03-05 14:18:54.145042+0100 Runner[62302:4633382] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported object <CPTabBarTemplate: 0x600002eb1b90> <identifier: 9BF1FB47-1108-4B07-A99D-FB70C58C836C, userInfo: (null), tabTitle: (null), tabImage: (null), showsTabBadge: 0> passed to setRootTemplate:animated:completion:. Allowed classes: (null)'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010ea52ba4 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x000000010c536be7 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010ea52a82 -[NSException initWithCoder:] + 0
	3   CarPlay                             0x000000013bf9a786 CPAssertAllowedClasses + 147
	4   CarPlay                             0x000000013bf9a64b -[CPInterfaceController setRootTemplate:animated:completion:] + 288
	5   flutter_carplay                     0x000000010c3be4a5 $s15flutter_carplay27FlutterCarPlaySceneDelegateC019templateApplicationF0_10didConnectySo010CPTemplateiF0C_So21CPInterfaceControllerCtF + 725
	6   flutter_carplay                     0x000000010c3be5f7 $s15flutter_carplay27FlutterCarPlaySceneDelegateC019templateApplicationF0_10didConnectySo010CPTemplateiF0C_So21CPInterfaceControllerCtFTo + 71
	7   CarPlay                             0x000000013bfcc456 -[CPTemplateApplicationScene _deliverInterfaceControllerToDelegate] + 620
	8   CarPlay                             0x000000013bfcb1d1 __64-[CPTemplateApplicationScene initWithSession:connectionOptions:]_block_invoke.23 + 125
	9   Foundation                          0x000000010bea0178 -[__NSObserver _doit:] + 287
	10  CoreFoundation                      0x000000010e992f2c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
	11  CoreFoundation                      0x000000010e992ef2 ___CFXRegistrationPost_block_invoke + 49
	12  CoreFoundation                      0x000000010e992454 _CFXRegistrationPost + 496
	13  CoreFoundation                      0x000000010e991d87 _CFXNotificationPost + 806
	14  Foundation                          0x000000010bea09a3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 82
	15  UIKitCore                           0x00000001261372e9 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1579
	16  UIKitCore                           0x0000000126db3869 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1299
	17  UIKitCore                           0x0000000126db3d16 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 289
	18  UIKitCore                           0x000000012683339a -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 358
	19  FrontBoardServices                  0x00000001129426f0 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 419
	20  FrontBoardServices                  0x000000011296edfb __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.180 + 102
	21  FrontBoardServices                  0x0000000112950b72 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
	22  FrontBoardServices                  0x000000011296e9da __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 352
	23  libdispatch.dylib                   0x000000011172ba2c _dispatch_client_callout + 8
	24  libdispatch.dylib                   0x000000011172e923 _dispatch_block_invoke_direct + 295
	25  FrontBoardServices                  0x0000000112995a19 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
	26  FrontBoardServices                  0x000000011299590f -[FBSSerialQueue _targetQueue_performNextIfPossible] + 174
	27  FrontBoardServices                  0x0000000112995a41 -[FBSSerialQueue _performNextFromRunLoopSource] + 19
	28  CoreFoundation                      0x000000010e9c0e15 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	29  CoreFoundation                      0x000000010e9c0d0d __CFRunLoopDoSource0 + 180
	30  CoreFoundation                      0x000000010e9c01e2 __CFRunLoopDoSources0 + 242
	31  CoreFoundation                      0x000000010e9ba941 __CFRunLoopRun + 875
	32  CoreFoundation                      0x000000010e9ba0f3 CFRunLoopRunSpecific + 567
	33  GraphicsServices                    0x00000001173dacd3 GSEventRunModal + 139
	34  UIKitCore                           0x0000000126db1f42 -[UIApplication _run] + 928
	35  UIKitCore                           0x0000000126db6b5e UIApplicationMain + 101
	36  Runner                              0x00000001004d1bff main + 63
	37  dyld                                0x0000000109069ee9 start_sim + 10
	38  ???                                 0x0000000200bdc4fe 0x0 + 8602371326
	39  ???                                 0x0000000000000003 0x0 + 3
)
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/*****************/Library/Developer/Xcode/DerivedData/Runner-brwkyruvrfkxfheflvndjdwcajyk/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/*****************/Library/Developer/Xcode/DerivedData/Runner-brwkyruvrfkxfheflvndjdwcajyk/Build/Products/Debug-iphonesimulator
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported object <CPTabBarTemplate: 0x600002eb1b90> <identifier: 9BF1FB47-1108-4B07-A99D-FB70C58C836C, userInfo: (null), tabTitle: (null), tabImage: (null), showsTabBadge: 0> passed to setRootTemplate:animated:completion:. Allowed classes: (null)'
terminating with uncaught exception of type NSException
CoreSimulator 783.5 - Device: iPhone 6s Plus (7A9868FC-ABE2-4CD0-842F-65ED33B75997) - Runtime: iOS 15.2 (19C51) - DeviceType: iPhone 6s Plus
_LSContextInitReturningError() failed with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0xf6701f12 bb1a56bb bba5f39f 3f7801a6 ... f9fe6ee0 ef307d24 }, _LSLine=405, WrongSimulatorHash={length = 32, bytes = 0x9da4b2b1 56f7ac19 1a99bc21 b7ec95c2 ... c4004d14 03ef83dc }}

Flutter doctor -v :

[✓] Flutter (Channel stable, 2.10.3, on macOS 12.2.1 21D62 darwin-arm, locale fr-FR)
    • Flutter version 2.10.3 at /Users/*********************/Documents/Softwares/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (3 days ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/*********************/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • ANDROID_HOME = /Users/*********************/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/*********************/Library/Android/sdk
    • Java binary at: /Users/*********************/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8193401/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] Android Studio (version 2021.1)
    • Android Studio at /Users/*********************/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8193401/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] Android Studio (version 2021.1)
    • Android Studio at /Users/*********************/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8139111/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
    • IntelliJ at /Users/*********************/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
    • IntelliJ at /Users/*********************/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.6777.52/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
    • iPhone 6s Plus (mobile) • 7A9868FC-ABE2-4CD0-842F-65ED33B75997 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • Chrome (web)            • chrome                               • web-javascript • Google Chrome 99.0.4844.51
    ! Error: iPhone de ********************* is not connected. Xcode will continue when iPhone de ********************* is connected. (code -13)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

@nimisis
Copy link

nimisis commented Mar 11, 2022

Same problem here. Using an M1 Pro so added 'arm64' to 'excluded architectures' in the build settings. Emulator is running iOS 15.2

@EArminjon
Copy link

Same problem here. Using an M1 Pro so added 'arm64' to 'excluded architectures' in the build settings. Emulator is running iOS 15.2

It fix the issue ?

@nimisis
Copy link

nimisis commented Mar 11, 2022

Apologies, no the issue remains.

@oguzhnatly oguzhnatly added the in testing This issue has been testing label Mar 15, 2022
@oguzhnatly oguzhnatly self-assigned this Mar 15, 2022
@EArminjon
Copy link

Hi, any news ?

@EArminjon
Copy link

Up ?

@EArminjon
Copy link

up ?

@bypass112
Copy link

bypass112 commented May 31, 2022

Hi, I think I found the problem with the crash, are you by any chance using an M1 emulator to test the app? If so it seems that the flutter_carplay plugin has arm64 as an excluded architecture so it won't build the required library for the M1 emulator.
After I've removed the excluded arm64 from flutter_carplay.release.xconfig and flutter_carplay.debug.xconfig (in my local M1 machine) and removed arm64 from the Excluded Architectures (in the Runner project) I've finally managed to run the app in the emulator with the CarPlay emulator attached.
Useful links: https://stackoverflow.com/questions/69492765/carplay-setroottemplate-crash-allowed-classes-null
The fact that it throws "Allowed classes: (null)" was a dead giveaway that the app wasn't including the flutter_carplay library properly.
I recommend that the excluded arm64 should be removed from this project GitHub because it will just cause issues with the M1 CarPlay simulator.
In the meantime you can use a third-party CarPlay screen, remove the definitions as I did, or just go to your car and test the app.

@bypass112
Copy link

Also as a sidenote you can clone the Github repo and just remove from the podspec 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'

@oguzhnatly oguzhnatly linked a pull request Jun 5, 2022 that will close this issue
@oguzhnatly
Copy link
Owner

oguzhnatly commented Jun 5, 2022

Version 1.0.3 has been published in pub.dev. Check it out here. 🎉

Thank you for @EArminjon's contribution with #14. This issue has been marked as resolved and closed. Please continue the discussion if the issue remains and don't forget to join the Discord Server, so we can chat over there!

@qiaoming1990321
Copy link

i only launch the carplay, in this time , app do not launch, the carplay always gray, there is nothing in the carplay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers in testing This issue has been testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants