| 123456789101112131415161718192021222324252627282930 |
- import UIKit
- import Flutter
- @UIApplicationMain
- @objc class AppDelegate: FlutterAppDelegate {
- override func application(
- _ application: UIApplication,
- didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
- ) -> Bool {
- GeneratedPluginRegistrant.register(with: self)
- return super.application(application, didFinishLaunchingWithOptions: launchOptions)
- }
- func connectionShouldUseCredentialStorage(_ connection: NSURLConnection) -> Bool {
- return true
- }
- func connection(_ connection: NSURLConnection, willSendRequestFor challenge: URLAuthenticationChallenge) {
- if let previous = challenge.previousFailureCount as? ssize_t {
- print(String(format: "didReceiveAuthenticationChallenge %@ %zd", challenge.protectionSpace.authenticationMethod, previous))
- }
- if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
- challenge.sender?.use(URLCredential(for: challenge.protectionSpace.serverTrust), for: challenge)
- challenge.sender?.continueWithoutCredential(for: challenge)
- }
- }
- func connection(_ connection: NSURLConnection, canAuthenticateAgainstProtectionSpace protectionSpace: URLProtectionSpace) -> Bool {
- return protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust
- }
- }
|