Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

TextView crashes app because textAttachmentDelegate? not set.

オープン
#1,397 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
swift
領域
mobile

調査の方向性

TextView の storage(_:placeholderFor:) の実装と、レポートで言及されている他の storage 関数を特定します。それらの fatalError の動作を textAttachmentDelegate のドキュメントと比較し、delegate なしで SwiftUI TextView をレンダリングしてもクラッシュせず、remote images が空のままになることを確認します。

索引モデルが issue の本文から書いたものです。

説明

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

  1. 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.
simulator_screenshot_BCB48876-BD8C-45A0-AE68-F9D31201CD38

Smartphone (please complete the following information):

  • Device: iPhone 15 Pro
  • OS: 17.5.1

Additional context
Add any other context about the problem here.

主要言語
Swift
スター
667
フォーク
153
平均マージ
2日 6時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

wordpress-mobile/AztecEditor-iOS のほかの issue

wordpress-mobile/AztecEditor-iOS の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。