Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

[IOS] .getAll() and .get() always returns an empty object #152

Open
PlaiyTiziano opened this issue Jul 25, 2019 · 7 comments
Open

[IOS] .getAll() and .get() always returns an empty object #152

PlaiyTiziano opened this issue Jul 25, 2019 · 7 comments

Comments

@PlaiyTiziano
Copy link

We have been using this package for a while now and it has always worked up until now, since we updated our react-native version to 0.60.4 both of the above stated functions always return an empty object.

Could use some help on why this is happening.

React-native version: 0.60.4
React-native-cookies version: 3.3.0

@LLEmily
Copy link

LLEmily commented Aug 2, 2019

same

@LLEmily
Copy link

LLEmily commented Aug 2, 2019

do you find way to work?

@LLEmily
Copy link

LLEmily commented Aug 2, 2019

the react-native-webview use wkwebview default , the react-native-cookies can't work with wkwebview . you can set useWebkit of react-native-webview to false. then react-native-cookies can work, have a try!

@linda90321
Copy link

same

@JuliyaShirokova
Copy link

same problem on:
React-native version: 0.60.5
React-native-cookies version: 3.3.0

@JuliyaShirokova
Copy link

For me (React-native version: 0.60.5) work's next steps:

  1. npm install git+https://github.com/joeferraro/react-native-cookies
  2. in my project go to 'node_modules/react-native-cookie/ios/RNCookieManagerIOS/RNCookieManagerIOS.m' and delete this function:
    RCT_EXPORT_METHOD(getAll:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; NSMutableDictionary *cookies = [NSMutableDictionary dictionary]; for (NSHTTPCookie *c in cookieStorage.cookies) { NSMutableDictionary *d = [NSMutableDictionary dictionary]; [d setObject:c.value forKey:@"value"]; [d setObject:c.name forKey:@"name"]; [d setObject:c.domain forKey:@"domain"]; [d setObject:c.path forKey:@"path"]; [d setObject:[self.formatter stringFromDate:c.expiresDate] forKey:@"expiresDate"]; [cookies setObject:d forKey:c.name]; } }
  3. Build project on REAL DEVICE

@safaiyeh
Copy link

safaiyeh commented Jan 2, 2020

I have forked the repo here: https://github.com/safaiyeh/react-native-cookie-store
We can create issues and PRs there to continue the development of the project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants