Cordova Inappbrowser clearcache=no not working on app restarts -iOS 10

Hi All,
I am facing an issue in an ionic iOS application where my website is not saving cookies and clearcache and clearsessioncache is not working.
I am using Cordova Inappbrowser plugin.

In Android, it is working perfectly.

var ref =, '_blank','location=no,toolbar=yes,clearcache=no,clearsessioncache=no');

But, in iOS it is not working. When, i first provide my credentials, and go into the app and then i exit the app and reopen it, it again asks for my credentials( Which works perfectly in ANDROID )

Upon further digging, i found that the cookie which were meant to be saved are marked as isSessionOnly=true and expires=null.

I found that writing the following code in CDVinAppbrowser.m class:

- (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
       NSHTTPCookie *cookie;
       NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [cookieJar cookies]) {
       NSLog(@"%@", cookie);

So, how to save cookies or make the inappbrowser with options working with clearcache=no and clearsessioncache=no in iOS.

Note: I am completely new to iOS/Swift. So, i need to know where to place the code in the swift classes.

@Janson @bengtler Tagging you guys because its urgent

How did you solve this problem?