I am getting the following error screen sometimes when I reload my React Native app in iOS Simulator.
Sometimes it doesn't happen at all but sometimes a few times during the day.
I am using SignalR client in my app as well as Firebase Messaging.
I have tried to put a try catch blocks to all of my app including where I use AsyncStorage but this is still happening.
Very frustrating.
my problem was with source of the images that i had in my component. i had tell the image components to pass null as source while response of the server for the image was empty or null. means:
<Image source={{uri: null}} style={styles.myImageStyle}/>
it was ok with android but in ios i ran into this error. so i changed my code to following and it's working fine now.
const imageUri = myImageUri!=null ? myImageUri : ""
<Image source={imageUri.length!=0?{uri: imageuri}: null} style={styles.myImageStyle}/>
I ran into this when using AsyncStorage. It can only store strings, so storing anything else won't work, like objects etc. Below is how I set and get an array of blocked users.
When you set your item, stringify it:
AsyncStorage.setItem('blocked_users', JSON.stringify(array));
Then when you read it from async storage, use a promise and json parse the data:
AsyncStorage.getItem("blocked_users")
.then((value) => {
if(value){
blocksArray = JSON.parse(value);
this.setState({ blocked_users: blocksArray});
};
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With