-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
We have encountered an issue in our application affecting users on iOS 17. Our users experience crashes due to the deprecated use of UIGraphicsBeginImageContextWithOptions in the HTMLAttachmentRenderer. As UIGraphicsBeginImageContext is deprecated in iOS 17, it sometimes throws errors under certain conditions:
Fatal Exception: NSInternalInconsistencyException
UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={-1, -1}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x83f20 __exceptionPreprocess
1 libobjc.A.dylib 0x172b8 objc_exception_throw
2 Foundation 0x6de934 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:]
3 UIKitCore 0xc2e34 _UIGraphicsBeginImageContextWithOptions
4 Pipedrive 0x852ab4 specialized HTMLAttachmentRenderer.textView(_:imageFor:with:) + 41 (HTMLAttachmentRenderer.swift:41)
5 Pipedrive 0x8aeca4 specialized TextView.storage(_:imageFor:with:) + 2158 (TextView.swift:2158)
6 Pipedrive 0x890748 protocol witness for RenderableAttachmentDelegate.attachment(_:imageForSize:) in conformance TextStorage + 584 (TextStorage.swift:584)
7 Pipedrive 0x852610 specialized HTMLAttachment.image(forBounds:textContainer:characterIndex:) + 92 (HTMLAttachment.swift:92)
8 Pipedrive 0x851a80 @objc HTMLAttachment.image(forBounds:textContainer:characterIndex:) (<compiler-generated>)
9 UIFoundation 0x84784 -[NSLayoutManager(NSPrivate) showAttachment:inRect:textContainer:characterIndex:]
10 UIFoundation 0x8173c -[NSLayoutManager(NSPrivate) _drawGlyphsForGlyphRange:atPoint:]
11 UIFoundation 0x2e830 -[NSTextStorage coordinateReading:]
12 UIKitCore 0x112f240 -[_UITextViewCanvasView drawTextInRect:]
13 UIKitCore 0x112ee44 -[_UITextCanvasView drawRect:]
14 UIKitCore 0xc2270 -[UIView(CALayerDelegate) drawLayer:inContext:]
15 UIKitCore 0x113055c -[_UITextTiledLayer drawInContext:]
16 QuartzCore 0xf92e0 CABackingStoreUpdate_
17 QuartzCore 0xf91d8 invocation function for block in CA::Layer::display_()
18 QuartzCore 0x808cc -[CALayer _display]
19 QuartzCore 0x7eefc CA::Layer::layout_and_display_if_needed(CA::Transaction*)
20 QuartzCore 0xd9fd8 CA::Context::commit_transaction(CA::Transaction*, double, double*)
21 QuartzCore 0x4eee0 CA::Transaction::commit()
22 QuartzCore 0x98c34 CA::Transaction::flush_as_runloop_observer(bool)
23 UIKitCore 0xb9ee8 _UIApplicationFlushCATransaction
24 UIKitCore 0xb7660 _UIUpdateSequenceRun
25 UIKitCore 0xb72a4 schedulerStepScheduledMainSection
26 UIKitCore 0xb8148 runloopSourceCallback
27 CoreFoundation 0x56834 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
28 CoreFoundation 0x567c8 __CFRunLoopDoSource0
29 CoreFoundation 0x54298 __CFRunLoopDoSources0
30 CoreFoundation 0x53484 __CFRunLoopRun
31 CoreFoundation 0x52cd8 CFRunLoopRunSpecific
32 GraphicsServices 0x11a8 GSEventRunModal
33 UIKitCore 0x40aae8 -[UIApplication _run]
34 UIKitCore 0x4bed98 UIApplicationMain
35 Pipedrive 0x78990 main + 19 (main.m:19)
36 ??? 0x1c37df154 (Missing)
Is there a way to avoid these types of errors, perhaps by replacing UIGraphicsBeginImageContext() with UIGraphicsImageRenderer?
Metadata
Metadata
Assignees
Labels
No labels