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

ExceptionsManager.js:94 RNCookieManagerIOS.getAll was called with 1 arguments but expects 0 arguments. #160

Open
cgfeel opened this issue Sep 24, 2019 · 5 comments

Comments

@cgfeel
Copy link

cgfeel commented Sep 24, 2019

I used RN 0.60.5, and got the following error:

ExceptionsManager.js:94 RNCookieManagerIOS.getAll was called with 1 arguments but expects 0 arguments. If you haven't changed this method yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.

My code:

import React from 'react';
import {Button} from 'react-native';

import CookieManager from 'react-native-cookies';

const useWebKit = true;
const onCookiesGet = () => {
    CookieManager.getAll(useWebKit).then(res => {
        console.log('CookieManager.getAll =>', res);
    });
};

const App = () => {
    return (
        <Button onPress={onCookiesGet}  title="getCookies" />
    );
};

export default App;

According to https://github.com/joeferraro/react-native-cookies#webkit-support-ios-only, it does say to pass a bool with the url to use the webkit support.

@gajjartejas
Copy link

Same here

@JuliyaShirokova
Copy link

Same problem on:
"react-native": "0.60.5",
"react-native-cookies": "^3.3.0",

@gajjartejas
Copy link

gajjartejas commented Oct 8, 2019

@JuliyaShirokova @aiyuchen See .m file two duplicate methods there

@JuliyaShirokova
Copy link

JuliyaShirokova commented Oct 9, 2019

For me 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

Thank you, gajjartejas!

@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

4 participants