in Education by
I have a web/ios react-native project. On web this works without any issue, but on iOS I am getting an error. Strangely, I dont see the error at all in the debug window, so I have to rely on the red screen. The way I am saving the data is like this: console.log(`user progress: writing string of >>${JSON.stringify(user.progress)}<< original's type: '${typeof user.progress}'`) await AsyncStorage.setItem( appConfig.constants.graphcool.progress, user.progress ) And that log is the last log I see in the debugger: user progress: writing string of >>{"VocabularyPairs":{"1":0.984375,"2":0.996875,"3":0.875}}<< original's type: 'object' I am getting a red screen with error in iOS: Exception '-[NSDictionaryM length]: unrecognized selector sent to instance 0x2832c5ce0' was thrown while invoking multiSet on target AsyncLocalStorage with params ( ( ( progress, { VocabularyPairs = { 1 = "0.984375"; 2 = "0.996875"; 3 = "0.875"; }; } ) ), 311 ) So -- I can fix this by changing the code: await AsyncStorage.setItem( appConfig.constants.graphcool.progress, Platform.OS === 'ios' ? JSON.stringify(user.progress): user.progress ) But my question is, why do I have to? If I do fix it, there are two other places that also set this same item -- one already has that wrapper, the other does not. Both work, and it is always almost the same data -- the numbers (that is, the values) may change, but they are string-keys and number values everywhere. What makes the first write special? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
If you are using AsyncStorage.setItem value should be a string. Passing object instead of string should not work! AsyncStorage.setItem(key: string, value: string, [callback]: ?(error: ?Error) => void) REFERE DOCS HERE

Related questions

0 votes
    I have to download images to my iOS apps local file system and read them back. On my simulator I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 6, 2022 in Education by JackTerrance
0 votes
    Hello All,I am using react-navigation v3 for navigation purposes.I have created a tab navigator called ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 30, 2022 in Education by JackTerrance
0 votes
    This problem is only appearing on iOS. The application is built with react-native 0.57.7 and on ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    Which JSON framework is supported by iOS?...
asked Nov 30, 2020 in Technology by JackTerrance
0 votes
    Hi I know it's a known issue about the auto height of webview in react native, and I have tried ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    Warning: Possible Unhandled Promise Rejection (id: 0) TypeError: Object is not a function (evaluating ' ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 3, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    my AndroidManifest.xml looks like this: and I get this error: * What went wrong: Execution failed for ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    I am using Firebase authentication and react-redux in my app. I added firebase.auth().onAuthStateChanged to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I am using Firebase authentication and react-redux in my app. I added firebase.auth().onAuthStateChanged to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I have a particular context in which one data are transformed a lot to get transferred across network. At ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    Q. Hybrid app Combines of both web apps and Native apps true/false Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    Which of the following option will have access to all native features? (1)Web apps (2)Hybrid apps (3)Native apps...
asked Nov 30, 2020 in Technology by JackTerrance
0 votes
    How to get ASP.NET Web API to return JSON instead of XML using Chrome?...
asked Jan 11, 2021 in Technology by JackTerrance
0 votes
    How to pass json format data on ajax call?...
asked Dec 10, 2020 in Technology by JackTerrance
...