diff --git a/ios/Classes/MyCookieManager.swift b/ios/Classes/MyCookieManager.swift index f8fca748..1af7f8d6 100755 --- a/ios/Classes/MyCookieManager.swift +++ b/ios/Classes/MyCookieManager.swift @@ -131,11 +131,14 @@ public class MyCookieManager: ChannelDelegate { } } - let cookie = HTTPCookie(properties: properties)! - MyCookieManager.httpCookieStore.setCookie(cookie, completionHandler: {() in - result(true) - }) + if let cookie = HTTPCookie(properties: properties) { + MyCookieManager.httpCookieStore.setCookie(cookie, completionHandler: {() in + result(true) + }) + } else { + result(false) + } } public static func getCookies(url: String, result: @escaping FlutterResult) {