Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.7k views
in Technique[技术] by (71.8m points)

swift - UIAlertView is deprecated and unavailable for UIScene based applications, please use UIAlertController

I'm new to Swift and I'm getting this Error.

I don't get it because I don't use any type of alert in my code.

Here is my ViewController:

import UIKit
import WebKit

class ViewController: UIViewController{

    @IBOutlet weak var webView: WKWebView!
    override func viewDidLoad() {
        super.viewDidLoad()

        let url = URL(string: "https://www.google.com/maps")!
        webView.load(URLRequest(url: url))
    }
}

I only want to use WKWebView in my app and use the location.

I already added NSLocationAlwaysAndWhenInUseUsageDescription to the info.plist

You can reproduce this error if you using iOS 13, Xcode and this example and any website which uses the location like google maps.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I was also going through the same issue, i'm able to solve it getting help from a developer, scene base application that is new yet not support ui alert view so it crashes the app, we can remove the scene base application we can use window base app, follow these steps to resolve the issue:

First remove the SceneDelegate file check this image for first step Second remove UISceneSession Lifecycle two methods from AppDelegate file check this image for second step Third go to your info plist and remove Application Scene Manifest Entry from it check this image for third step Go ahead and build the project, run it now, make sure you have window property in AppDelegate


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...