5

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.

Soteri
  • 197
  • 3
  • 19
  • Which line of code exactly is causing that error? Are you getting the error at compile time or at runtime? – rmaddy Oct 01 '19 at 15:34
  • title is irrelevant to code you post – Sh_Khan Oct 01 '19 at 15:35
  • @rmaddy I'm getting this error at runtime – Soteri Oct 01 '19 at 15:38
  • @Sh_Khan I wanted to show that I'm not using a type of alert – Soteri Oct 01 '19 at 15:38
  • What code is your app running at the time the message appears in the console? – rmaddy Oct 01 '19 at 15:39
  • Looks like this is a [duplicate](https://stackoverflow.com/questions/32690086/uialertview-first-deprecated-ios-9/34151288). UIAlertView is no longer used. Scroll down for the swift answer. – HJDavies Oct 01 '19 at 15:43
  • @HJDavies no because I'm not using an alert so I can't cange it to the new one... – Soteri Oct 01 '19 at 15:49
  • @rmaddy the app crashes everytime I want to get the location. Like opening google maps in the WKWebView and clicking the get position button – Soteri Oct 01 '19 at 15:53
  • Other than the message, is your app working and are you able to get the location? – rmaddy Oct 01 '19 at 15:57
  • @rmaddy what do you mean? Because I only ask for the question over this website which hasn't anything to do with this app – Soteri Oct 01 '19 at 15:59

1 Answers1

16

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

Faisal Nadeem
  • 186
  • 1
  • 7