NSURLConnection Error Code -1100

I'm trying to load content into a UIWebView, and when testing in the simulator, all I get is a white screen and the following error in the console:

NSURLConnection finished with error - code -1100  

Can anyone help? My current Swift code is:

class ViewController: UIViewController {  
    @IBOutlet weak var webView: UIWebView!  

    override func viewDidLoad() {  
        super.viewDidLoad()  

        webView.allowsInlineMediaPlayback = true;         
        webView.mediaPlaybackRequiresUserAction = false;  

        webView.loadRequest(URLRequest(url: URL(fileURLWithPath: Bundle.main.path(forResource: "www/index", ofType: "html")!)))  

        let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView  
        statusBar?.backgroundColor = UIColor.clear  

    }  
}  

Just to clarify, this code works for me, but I cannot find anything on the Internet regarding error -1100. Many thanks.

+11
source share
4 answers

-1100means NSURLErrorFileDoesNotExist. And you get access to the local file, type the URL absoluteStringto check if the path is suitable for this file.

+6
source

For my network, the network did not connect properly. Then I turned on my data connection, and then I decided.

+1
source

- ?

0

NSURLRequest: URL-

  • NSURLErrorUnknown

, URL , .

  • NSURLErrorCancelled

.

  • NSURLErrorBadURL

, URL- , URL-

  • NSURLErrorTimedOut

.

  • NSURLErrorUnsupportedURL

, URL- .

  • NSURLErrorCannotFindHost

, URL- .

  • NSURLErrorCannotConnectToHost

.

  • NSURLErrorDataLengthExceedsMaximum

, .

  • NSURLErrorNetworkConnectionLost

, .

  • NSURLErrorDNSLookupFailed

NSURLErrorCannotFindHost

  • NSURLErrorHTTPTooManyRedirects

, ( 16).

  • NSURLErrorResourceUnavailable

, .

  • NSURLErrorNotConnectedToInternet

, , - , .

  • NSURLErrorRedirectToNonExistentLocation

, , URL- .

  • NSURLErrorBadServerResponse

, URL- .

  • NSURLErrorUserCancelledAuthentication

, .

  • NSURLErrorUserAuthenticationRequired

, .

  • NSURLErrorZeroByteResource

, , URL- , "" - .

  • NSURLErrorCannotDecodeRawData​​li >

, , NSURLConnection, .

  • NSURLErrorCannotDecodeContentData​​li >

, , NSURLConnection, .

  • NSURLErrorCannotParseResponse

, NSURLConnection .

  • NSURLErrorInternationalRoamingOff

, , .

  • NSURLErrorCallIsActive

, (EDGE GPRS).

  • NSURLErrorDataNotAllowed

, .

  • NSURLErrorRequestBodyStreamExhausted

, , . iOS, POST, , NSURLConnection: needNewBodyStream.

  • NSURLErrorFileDoesNotExist

, .

  • NSURLErrorFileIsDirectory

, FTP , , , .

  • NSURLErrorNoPermissionsToReadFile

, - .

  • NSURLErrorSecureConnectionFailed

, , .

  • NSURLErrorServerCertificateHasBadDate

, , , .

  • NSURLErrorServerCertificateUntrusted

, , .

  • NSURLErrorServerCertificateHasUnknownRoot

, .

  • NSURLErrorServerCertificateNotYetValid

, .

  • NSURLErrorClientCertificateRejected

.

  • NSURLErrorClientCertificateRequired

, SSL- NSURLConnection.

  • NSURLErrorCannotLoadFromNetwork

, .

  • NSURLErrorCannotCreateFile

, NSURLDownload - -.

  • NSURLErrorCannotOpenFile

, NSURLDownload .

  • NSURLErrorCannotCloseFile

, NSURLDownload .

  • NSURLErrorCannotWriteToFile

, NSURLDownload .

  • NSURLErrorCannotRemoveFile

, NSURLDownload .

  • NSURLErrorCannotMoveFile

, NSURLDownload .

  • NSURLErrorDownloadDecodingFailedMidStream

, NSURLDownload .

  • NSURLErrorDownloadDecodingFailedToComplete

Returns when NSURLDownload failed to decode the encoded file after downloading.

  • NSURLErrorAppTransportSecurityRequiresSecureConnection

  • NSURLErrorBackgroundSessionInUseByAnotherProcess

  • NSURLErrorBackgroundSessionRequiresSharedContainer

  • NSURLErrorBackgroundSessionWasDisconnected

  • NSURLErrorFileOutsideSafeArea

-2
source

Source: https://habr.com/ru/post/1686426/


All Articles