App Crashes on Paper Selection After Background Printer Connection

Description: 1. When initiating the print flow via UIPrintInteractionController, and no printer is initially connected, iOS displays all possible paper sizes in the paper selection UI. However, if a printer connects in the background after this view is shown, the list of paper sizes does not automatically refresh to reflect only the options supported by the connected printer. 2. If the user selects an incompatible paper size (one not supported by the printer that has just connected), the app crashes due to an invalid configuration.

Steps to Reproduce:

  1. Launch the app and navigate to the print functionality.
  2. Tap the Print button to invoke UIPrintInteractionController.
  3. At this point, no printer is yet connected. iOS displays all available paper sizes.
  4. While the paper selection UI is visible, the AirPrint-compatible printer connects in the background.
  5. Without dismissing the controller, the user selects a paper size (e.g., one that is not supported by the printer).
  6. The app crashes.

Expected Result: App should not crash

  1. Once the printer becomes available (connected in the background), the paper size options should refresh automatically.
  2. The list should be filtered to only include sizes that are compatible with the connected printer.
  3. This prevents the user from selecting an invalid option, avoiding crashes.

Actual Result: App crashes

  1. The paper size list remains unfiltered.
  2. The user can still select unsupported paper sizes.
  3. Selecting an incompatible option causes the app to crash, due to a mismatch between UI selection and printer capability.

Demo App Crash : https://drive.google.com/file/d/19PV02wzOJhc2DYI6kAe-uxHuR1Qg15Bu/view?usp=sharing Apple Files App Crash: https://drive.google.com/file/d/1flHKuU_xaxHSzRun1dYlh8w7nBPJZeRb/view?usp=sharing

Yes, we see a lot of crashes like this in our apps, too. But we can't reproduce it.

OS Version:          iPhone OS 18.6 (22G86)
Release Type:        User
Baseband Version:    2.70.02
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Reason: *** -[__NSSingleObjectArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 0]
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: OurAppName [72412]

Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                	0x1950500c0 __exceptionPreprocess + 164 (NSException.m:249)
1   libobjc.A.dylib               	0x1924e9abc objc_exception_throw + 88 (objc-exception.mm:356)
2   CoreFoundation                	0x1950418c8 -[__NSSingleObjectArrayI objectAtIndex:] + 308 (NSSingleObjectArray.m:18)
3   PrintKitUI                    	0x1f34d4518 -[UIPrintPaperSizeOption listItemSelected:] + 88 (UIPrintMoreOptions.m:896)
4   PrintKitUI                    	0x1f34a0a0c -[UIPrintOptionListViewController tableView:didSelectRowAtIndexPath:] + 116 (UIPrintOptionCells.m:103)
5   UIKitCore                     	0x198b902fc -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:deselectPrevious:performCustomSelectionAction:] + 1184 (UITableView.m:9365)
6   UIKitCore                     	0x198b90620 -[UITableView _userSelectRowAtPendingSelectionIndexPath:animatedSelection:] + 256 (UITableView.m:9419)
7   UIKitCore                     	0x198b9072c -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 216 (UITableView.m:9438)
8   UIKitCore                     	0x1978b984c -[_UIAfterCACommitBlock run] + 72 (_UIAfterCACommitQueue.m:137)
9   UIKitCore                     	0x1978b9784 -[_UIAfterCACommitQueue flush] + 168 (_UIAfterCACommitQueue.m:228)
10  UIKitCore                     	0x19783e254 _runAfterCACommitDeferredBlocks + 260 (UIApplication.m:3284)
11  UIKitCore                     	0x19783df74 _cleanUpAfterCAFlushAndRunDeferredBlocks + 80 (UIApplication.m:3262)
12  UIKitCore                     	0x19783de84 _UIApplicationFlushCATransaction + 72 (UIApplication.m:3325)
13  UIKitCore                     	0x19783de0c __setupUpdateSequence_block_invoke_2 + 336 (_UIUpdateScheduler.m:1659)
14  UIKitCore                     	0x19783d404 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:136)
15  UIKitCore                     	0x19783cab4 schedulerStepScheduledMainSection + 208 (_UIUpdateScheduler.m:1173)
16  UIKitCore                     	0x1978381e4 runloopSourceCallback + 92 (_UIUpdateScheduler.m:1341)
17  CoreFoundation                	0x194f4592c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1970)
18  CoreFoundation                	0x194f45744 __CFRunLoopDoSource0 + 172 (CFRunLoop.c:2014)
19  CoreFoundation                	0x194f455a0 __CFRunLoopDoSources0 + 232 (CFRunLoop.c:2051)
20  CoreFoundation                	0x194f45f20 __CFRunLoopRun + 840 (CFRunLoop.c:2969)
21  CoreFoundation                	0x194f47adc CFRunLoopRunSpecific + 572 (CFRunLoop.c:3434)
22  GraphicsServices              	0x1e1d6d454 GSEventRunModal + 168 (GSEvent.c:2196)
23  UIKitCore                     	0x197969274 -[UIApplication _run] + 816 (UIApplication.m:3845)
24  UIKitCore                     	0x197934a28 UIApplicationMain + 336 (UIApplication.m:5540)
25  OurAppName                    	0x102a2a4dc main + 76 (main.m:16)
26  dyld                          	0x1bb9d9f08 start + 6040 (dyldMain.cpp:1450)
App Crashes on Paper Selection After Background Printer Connection
 
 
Q