CarPlay Crashing Crazily on iOS 15.4

After the release of iOS 15.4, I am receiving so many crash reports for CarPlay, and the percentage increased to +140%!

Here is one of the crash logs:

And here is a screenshot from Xcode Organizer, which shows too many wired crashes:

Accepted Reply

Termination Reason: FRONTBOARD 2343432205 
<RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-create watchdog transgression: application<com.FarouK.TarateelAl-Quran>:34785 exhausted CPU time allowance of 4.99 seconds

The app is being killed by the system because the app was unresponsive for more than 5 seconds.

From the stack, we can see what the app was doing at that time:

(snip)

34  CarPlay                       	       0x1ea88ad20 -[CPInterfaceController _pushListTemplate:presentationStyle:animated:completion:] + 272
35  CarPlay                       	       0x1ea888560 -[CPInterfaceController _pushTemplate:presentationStyle:animated:completion:] + 624
36  CarPlay                       	       0x1ea88b274 -[CPInterfaceController _pushTabBarTemplate:animated:completion:] + 340
37  CarPlay                       	       0x1ea8884f4 -[CPInterfaceController _pushTemplate:presentationStyle:animated:completion:] + 516
38  CarPlay                       	       0x1ea887cec -[CPInterfaceController setRootTemplate:animated:completion:] + 380
39  Quran                         	       0x100f53084 0x100ea4000 + 716932
40  Quran                         	       0x100f4f5c0 0x100ea4000 + 701888
41  CarPlay                       	       0x1ea8be190 -[CPTemplateApplicationScene _deliverInterfaceControllerToDelegate] + 616

We're missing the frames for your app's symbols, but in general it looks like the app had just been launched in CarPlay.

The app is busy creating a tab bar template that contains one or more list templates, and it took more than 5 seconds to encode all of the data contained within all of those templates for the system, so the app was terminated for being unresponsive.


(snip)

3   ImageIO                       	       0x1af8b3c40 png_compress_IDAT + 224
4   ImageIO                       	       0x1af8b6e24 png_write_find_filter + 392
5   ImageIO                       	       0x1af8bc2b8 _cg_png_write_row + 816
6   ImageIO                       	       0x1af8afe18 PNGWritePlugin::writePNG(IIOImagePixelDataProvider*, IIODictionary*) + 1140
7   ImageIO                       	       0x1af8a6fe8 PNGWritePlugin::writeAll() + 924
8   ImageIO                       	       0x1af8e7af8 PNGWritePlugin::WriteProc(void*, void*, void*, void*) + 112
9   ImageIO                       	       0x1af8cc910 IIOImageDestination::finalizeDestination() + 592
10  ImageIO                       	       0x1af8a45d0 CGImageDestinationFinalize + 132
11  UIKitCore                     	       0x1b0469480 UIImagePNGRepresentation + 496
12  UIKitCore                     	       0x1b0512cb0 -[UIImage _encodeDataWithCoder:imageName:] + 44
13  UIKitCore                     	       0x1b04ad770 -[UIImage encodeWithCoder:] + 684
14  Foundation                    	       0x1af606f00 -[NSXPCEncoder _encodeObject:] + 520
15  CarPlay                       	       0x1ea897600 -[CPImageSet encodeWithCoder:] + 160
16  Foundation                    	       0x1af606f00 -[NSXPCEncoder _encodeObject:] + 520
17  CarPlay                       	       0x1ea89aa60 -[CPListItem encodeWithCoder:] + 280

A little further up in the stack, we can see that the app was busy encoding images included with its list items.

In general, your app should launch and become responsive as quickly as possible so that it returns control flow to the system as soon as possible.

Here's what I would recommend:

  1. Try populating your tab bar template with fewer list templates. After the tab bar template has been set as your app's root template, you can update the tab bar template with additional templates, which will defer loading those tabs until later on.
  2. Try populating your list items without their images, since it looks like your app may have a large number of list items with images. You can use the dynamic setImage: method on a list item to update it with an image even after it's been presented on screen, and the system should reload that list item to display your updates, including any new images.
  3. Make sure that your list item images are being sized correctly for the car screen. You can use +[CPListItem maximumImageSize] to fetch the maximum image size (in resolution-independent points) for your list items, and you can use -[CPInterfaceController carTraitCollection] to fetch the display scale for the car screen. Keep in mind that the car screen may have a different display scale than the device's screen, so you should resize your images to be at most the maximum image size (in points) multiplied by the car screen's display scale. Make sure you resize your images down to that size at maximum before providing them to the system.

Replies

Termination Reason: FRONTBOARD 2343432205 
<RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-create watchdog transgression: application<com.FarouK.TarateelAl-Quran>:34785 exhausted CPU time allowance of 4.99 seconds

The app is being killed by the system because the app was unresponsive for more than 5 seconds.

From the stack, we can see what the app was doing at that time:

(snip)

34  CarPlay                       	       0x1ea88ad20 -[CPInterfaceController _pushListTemplate:presentationStyle:animated:completion:] + 272
35  CarPlay                       	       0x1ea888560 -[CPInterfaceController _pushTemplate:presentationStyle:animated:completion:] + 624
36  CarPlay                       	       0x1ea88b274 -[CPInterfaceController _pushTabBarTemplate:animated:completion:] + 340
37  CarPlay                       	       0x1ea8884f4 -[CPInterfaceController _pushTemplate:presentationStyle:animated:completion:] + 516
38  CarPlay                       	       0x1ea887cec -[CPInterfaceController setRootTemplate:animated:completion:] + 380
39  Quran                         	       0x100f53084 0x100ea4000 + 716932
40  Quran                         	       0x100f4f5c0 0x100ea4000 + 701888
41  CarPlay                       	       0x1ea8be190 -[CPTemplateApplicationScene _deliverInterfaceControllerToDelegate] + 616

We're missing the frames for your app's symbols, but in general it looks like the app had just been launched in CarPlay.

The app is busy creating a tab bar template that contains one or more list templates, and it took more than 5 seconds to encode all of the data contained within all of those templates for the system, so the app was terminated for being unresponsive.


(snip)

3   ImageIO                       	       0x1af8b3c40 png_compress_IDAT + 224
4   ImageIO                       	       0x1af8b6e24 png_write_find_filter + 392
5   ImageIO                       	       0x1af8bc2b8 _cg_png_write_row + 816
6   ImageIO                       	       0x1af8afe18 PNGWritePlugin::writePNG(IIOImagePixelDataProvider*, IIODictionary*) + 1140
7   ImageIO                       	       0x1af8a6fe8 PNGWritePlugin::writeAll() + 924
8   ImageIO                       	       0x1af8e7af8 PNGWritePlugin::WriteProc(void*, void*, void*, void*) + 112
9   ImageIO                       	       0x1af8cc910 IIOImageDestination::finalizeDestination() + 592
10  ImageIO                       	       0x1af8a45d0 CGImageDestinationFinalize + 132
11  UIKitCore                     	       0x1b0469480 UIImagePNGRepresentation + 496
12  UIKitCore                     	       0x1b0512cb0 -[UIImage _encodeDataWithCoder:imageName:] + 44
13  UIKitCore                     	       0x1b04ad770 -[UIImage encodeWithCoder:] + 684
14  Foundation                    	       0x1af606f00 -[NSXPCEncoder _encodeObject:] + 520
15  CarPlay                       	       0x1ea897600 -[CPImageSet encodeWithCoder:] + 160
16  Foundation                    	       0x1af606f00 -[NSXPCEncoder _encodeObject:] + 520
17  CarPlay                       	       0x1ea89aa60 -[CPListItem encodeWithCoder:] + 280

A little further up in the stack, we can see that the app was busy encoding images included with its list items.

In general, your app should launch and become responsive as quickly as possible so that it returns control flow to the system as soon as possible.

Here's what I would recommend:

  1. Try populating your tab bar template with fewer list templates. After the tab bar template has been set as your app's root template, you can update the tab bar template with additional templates, which will defer loading those tabs until later on.
  2. Try populating your list items without their images, since it looks like your app may have a large number of list items with images. You can use the dynamic setImage: method on a list item to update it with an image even after it's been presented on screen, and the system should reload that list item to display your updates, including any new images.
  3. Make sure that your list item images are being sized correctly for the car screen. You can use +[CPListItem maximumImageSize] to fetch the maximum image size (in resolution-independent points) for your list items, and you can use -[CPInterfaceController carTraitCollection] to fetch the display scale for the car screen. Keep in mind that the car screen may have a different display scale than the device's screen, so you should resize your images to be at most the maximum image size (in points) multiplied by the car screen's display scale. Make sure you resize your images down to that size at maximum before providing them to the system.

Thank you for your help, I was able to solve the problem.