プログラミングスクール最大70%OFF! ←クリックして見に行く

【Error】’xxx’ is only available in iOS 13.0 or newer

【Error】’xxx’ is only available in iOS 13.0 or newer

エラー解消方法の備忘録_φ(・_・ )

発生したエラー

’UIScene’ is only available in iOS 13.0 or newer

翻訳

「UIScene」はiOS 13.0以降で利用可能です。

原因

iOS 13.0以降でプロジェクトを新規作成した後にiOS 12以下にtargetを変更した際に、
SceneDelegate.swift と AppDelegate.swift にエラーが大量発生しました。

解決手順

「Fix」ボタンをクリックして、以下のどちらかを選択する
・Add @available attribute to enclosing instance method
・Add @available attribute to enclosing class

Point

Fixの選択肢は2つありますが、
「Add @available attribute to enclosing class」を選択することをおすすめします!

Add @available attribute to enclosing instance method を選択した場合

インスタントメソッド毎に@available 属性を追加しないといけないので面倒です(∩’-‘⊂)シュッ

Add @available attribute to enclosing class を選択した場合

クラスに@available 属性を追加するので、
メソッド毎にポチポチFixボタンを押さないで済みます( *˙ω˙*)و グッ!

Attention

実機ビルドをしようとすると画面が真っ暗になってしまった方は以下の記事も参考にどうぞ!
【Error】[Application] The app delegate must implement the window property if it wants to use a main storyboard file.
【Error】[Application] The app delegate must implement the window property if it wants to use a main storyboard file.

参考サイト

https://fluffy.es/allow-app-created-in-xcode-11-to-run-on-ios-12-and-lower/
https://stackoverflow.com/questions/56916948/xcode-11-backward-compatibility-uiwindowscene-is-only-available-in-ios-13-or-n

Swiftカテゴリの最新記事