iOS 17 Crash - UIGraphicsBeginImageContext() failed to allocate CGBitampContext

未關閉
#1,401 2 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

@jkmassel 已經在處理了。

開始於 2025年1月23日。

評估

這個 Issue 還沒有評估資料。

描述

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?

主要語言
Swift
星號
666
分支
154
平均合併
1 天 13 小時
30 天內合併 PR
5

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

wordpress-mobile/AztecEditor-iOS 的其他 Issue

查看 wordpress-mobile/AztecEditor-iOS 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。