#24 怎麼開發app,同時使用在iOS13 及更早的版本

因為iOS 13 新增了 SceneDelegate的頁面,導致我想在app開發時相容更舊的iOS版本,Xcode就會無情的跳出錯誤。

那應該怎麼修復他們呢?

Photo by Roberto Sorin on Unsplash

一、依錯誤提示,在AppDelegate, SceneDelegate加入@available(iOS 13.0, *)

二、加入後不再顯示error了,可是用比iOS13低的版本,無論是在模擬器還是手機實機都沒有畫面出現。

因為在iOS13以前是沒有SceneDelegate的,我們要把導向畫面的工作在AppDelegate完成。

所以只要在AppDelegate加上 一行 var window: UIWindow? 即可正常運行。

— — — — — — — — — — — — — — — — — —

SwiftUI的設置可參考Lumanman的文章

Debug View Hierarchy的進入方式,看法蘭克的文章

--

--

--

Wish me luck on the way become iOS app developer!

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Stephen Huang

Stephen Huang

Wish me luck on the way become iOS app developer!

More from Medium

Finding Favicon’s — A brief explanation

Converting Date and Time to a particular TimeZone

Integration of Apple Pay-Swift

How to display permission to track in iOS 14.5 and above in Objective-C?