I\'m using AsyncStorage.clear()
which is working just fine on Android but when run using iOS platform (real device) I\'m getting this error and can\'t find anything
When AsyncStorage is empty...
AsyncStorage.clear()
errors on iOS but not Android.
AsyncStorage.getAllKeys().then(AsyncStorage.multiRemove)
errors on Android but not iOS.
Our solution...
import { Platform } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
const asyncStorageKeys = await AsyncStorage.getAllKeys();
if (asyncStorageKeys.length > 0) {
if (Platform.OS === 'android') {
await AsyncStorage.clear();
}
if (Platform.OS === 'ios') {
await AsyncStorage.multiRemove(asyncStorageKeys);
}
}