TextView crashes app because textAttachmentDelegate? not set.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Locate TextView's storage(_:placeholderFor:) implementation and the other storage functions mentioned in the report. Compare their fatalError behavior with the textAttachmentDelegate documentation, then verify that rendering a SwiftUI TextView without the delegate no longer crashes and leaves remote images blank.
Written by the indexing model from the issue text.
Description
Describe the bug
TextView func storage(_ storage: TextStorage, placeholderFor attachment: NSTextAttachment) -> UIImage is crashing my app in production of the following guard statement contains a fatalError.
guard let textAttachmentDelegate = textAttachmentDelegate else {
fatalError("This class requires a text attachment delegate to be set.")
}
return textAttachmentDelegate.textView(self, placeholderFor: attachment)
The problem with this is that earlier in the file the following is explicitly stated for the textAttachmentDelegate optional.
/// The media delegate takes care of providing remote media when requested by the `TextView`.
/// If this is not set, all remove images will be left blank.
///
open weak var textAttachmentDelegate: TextViewAttachmentDelegate?
Which would imply that the TextView will continue to function, only without displaying images. Not fatalError crashing.
This seems to be the case with all of the storage functions.
To Reproduce
Steps to reproduce the behavior:
1.
Create an instance of the TextView without instantiating textAttachmentDelegate
- Render the Field in a SwiftUI view.
Expected behavior
A clear and concise description of what you expected to happen.
A TextView should continue to run rendering the HTML and images remain blank, WITHOUT crashing the app, as implied by the documentation. (Unless there is actually something called 'remove images'.)
Screenshots
If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
- Device: iPhone 15 Pro
- OS: 17.5.1
Additional context
Add any other context about the problem here.
- Dominant language
- Swift
- Stars
- 669
- Forks
- 153
- Avg merge
- 11h 27m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wordpress-mobile/AztecEditor-iOS
-
Bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
wordpress-mobile/AztecEditor-iOS#1417 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
wordpress-mobile/AztecEditor-iOS#1411 ·
-
wordpress-mobile/AztecEditor-iOS#1401 · 2 comments · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
wordpress-mobile/AztecEditor-iOS#1399 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
wordpress-mobile/AztecEditor-iOS#1398 · 1 comment · 1 reaction ·
All issues in wordpress-mobile/AztecEditor-iOS
Similar issues
-
area:dictation documentation P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
uttrflow/uttrflow-swift#1180 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
OneBusAway/onebusaway-ios#1451 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·