diff --git a/CHANGELOG.md b/CHANGELOG.md index df781e6d..8e064e4a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Merged "feat(ios): optional tradeoff to fix ios input delay" [#1665](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1665) (thanks to [andreasgangso](https://github.com/andreasgangso)) - Merged "Fix ios multiple flutter presenting error" [#1736](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1736) (thanks to [AlexT84](https://github.com/AlexT84)) - Merged "fix cert parsing for ios 12" [#1822](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1822) (thanks to [darkang3lz92](https://github.com/darkang3lz92)) +- Merged "Fix iOS and macOS Forced unwrap null value HTTPCookie for CookieManager.setCookie" [#1677](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1677) (thanks to [maxmitz](https://github.com/maxmitz)) ## 6.0.0-beta.25 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) { diff --git a/macos/Classes/MyCookieManager.swift b/macos/Classes/MyCookieManager.swift index 9ccce940..eed128a8 100755 --- a/macos/Classes/MyCookieManager.swift +++ b/macos/Classes/MyCookieManager.swift @@ -132,11 +132,13 @@ 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) {