I'm trying to get session Cookies of a Webview using InAppwebview and CoookieManager widget in my flutter App, it works fine in Android and IOS simulator but doesn't in IOS real device .
Here is my trial
IOS version : +11
Options :
sharedCookiesEnabled: true
incognito: false
build(BuildContext context) {
var cookieObj = CookieManager();
cookieObj.ios = IOSCookieManager();
InAppWebView(
initialOptions: InAppWebViewGroupOptions(
ios: IOSInAppWebViewOptions(sharedCookiesEnabled: true),
crossPlatform: InAppWebViewOptions(
incognito: false,
)),
initialUrlRequest: URLRequest(
url: Uri.parse("https://example.com"),
),
onUpdateVisitedHistory: (controller, url, androidIsReload) {},
onWebViewCreated: (controller) {},
onLoadStop: (controller, url) {
debugPrint(url!.origin);
cookieObj.ios.getAllCookies().then((list) {
if (list.isNotEmpty) {
var filteredList = list
.where((element) =>
element.domain == 'example.com' &&
element.isSessionOnly == true)
.toList();
if (filteredList.isNotEmpty) {
for (var element in filteredList) {
debugPrint('${element.name} : ${element.value}');
}
}
}
});
},
);
}
It retrieves when I'm inside webview once at first time "when it has been set ", but across my app. during navigation , I tried to cache it then , set it manually to the domain, not found as well.
I'm stuck at this for. while , so any help , thanks n advanced