3
votes

I don't want to pass any value to baseURL parameter in loadData method of UIWebView.

In Swift 1.2, nil works fine:

self.loadFundInfo.loadData(responseData, MIMEType: contentType, textEncodingName: "", baseURL: nil)

In Swift 2.0, how to do the same thing?

I am getting this error:

Nil is not compatible with expected argument type NSURL

1
More, details needed, the same should workAndrius Steponavičius
I added more details to it. If you require any more info, please let me know.Sabarish Padma Sekar
is the data being loaded from the disk?Andrius Steponavičius

1 Answers

1
votes

The error message is rather self-explanatory: the baseURL parameter must now be of type NSURL, not NSURL? (not an optional anymore, so it can not be nil).

Method signature in Swift 2 is:

loadData(data: NSData, MIMEType: String, textEncodingName: String, baseURL: NSURL)

The answer is you can't do the same thing, you have to provide a base URL.