Ich verwende den folgenden Code NSURLCredentials
abzurufen:Wie funktioniert diese Funktion/Variable?
let credentials: NSURLCredential? = {
let loginProtectionSpace = NSURLProtectionSpace(host: host, port: 0, protocol: NSURLProtectionSpaceHTTP, realm: nil, authenticationMethod: NSURLAuthenticationMethodDefault)
let credentials = NSURLCredentialStorage.sharedCredentialStorage().defaultCredentialForProtectionSpace(loginProtectionSpace)
return credentials
}()
Dies wird aufgerufen, wenn der Benutzer die App öffnet. Die zurückgegebenen Anmeldeinformationen sind null. Dann lege ich diese Anmeldeinformationen fest und versuche, die Anmeldeinformationen erneut auszudrucken, und es ist immer noch Null. Wenn ich die App neu starte, sind die gedruckten Anmeldeinformationen jedoch vorhanden. Was ist denn hier los?