Post

Replies

Boosts

Views

Activity

crash on iOS 15 when use UIPrintInteractionController to print PDF file
Is is a bug of iOS 15 itself? What can I do to fix this? It crashs when [UIPrintPreviewViewController reloadVisibleItems] It only happends on iOS from 15.0.0 to 15.5.0 so far When will UIPrintPreviewViewController reloadVisibleItems ? We can't even reproduce the crash, but we get lots crash reports on Firebase. Source code UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController]; if (controller) { UIPrintInfo *printInfo = [UIPrintInfo printInfo]; printInfo.outputType = UIPrintInfoOutputGeneral; printInfo.duplex = UIPrintInfoDuplexLongEdge; controller.printInfo = printInfo; controller.printingItems = [self dataList]; LYWeakifySelf; void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *controller, BOOL completed, NSError *error) { }; [controller presentAnimated:YES completionHandler:completionHandler]; } - (NSArray<NSData *> *)dataList { NSMutableArray *dataList = [NSMutableArray array]; [self enumerateDataUsingBlock:^(NSData *data, NSString *fileName) { [dataList addObject:data]; }]; return dataList; } Crash info on Firebase Fatal Exception: NSInternalInconsistencyException. attempt to delete item 1 from section 0 which only contains 0 items before the update. Stack trace 0 CoreFoundation __exceptionPreprocess 1 libobjc.A.dylib objc_exception_throw 2 Foundation _userInfoForFileAndLine 3 UIKitCore -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] 4 UIKitCore -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] 5 UIKitCore -[UICollectionView reloadItemsAtIndexPaths:] 6 UIKitCore -[UIPrintPreviewViewController reloadVisibleItems:] 7 UIKitCore __58-[UIPrintPreviewViewController updateLayoutWithPdfUpdate:]_block_invoke_2 8 Foundation __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ 9 Foundation -[NSBlockOperation main] 10 Foundation __NSOPERATION_IS_INVOKING_MAIN__ 11 Foundation -[NSOperation start] 12 Foundation __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ 13 Foundation __NSOQSchedule_f 14 libdispatch.dylib _dispatch_block_async_invoke2 15 libdispatch.dylib _dispatch_client_callout 16 libdispatch.dylib _dispatch_main_queue_drain 17 libdispatch.dylib _dispatch_main_queue_callback_4CF 18 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ 19 CoreFoundation __CFRunLoopRun 20 CoreFoundation CFRunLoopRunSpecific 21 GraphicsServices GSEventRunModal 22 UIKitCore -[UIApplication _run] 23 UIKitCore UIApplicationMain 24 EverLens main.m - Line 14 main + 14
1
0
1.5k
Aug ’22