I try to fetch images in React Native from my Django Rest Api. The Fetch works and i get all the data in my array, but i missing the image when i open it in expo on my iOS Device.
I have read that http is not allowed on iOS but how can i show my images now in development?
Hope you can help me.
Fetch my data
function getbannerdata(){ return fetch ('http://192.168.178.46:8000/intranet/messages/', { method: 'GET', headers: {'Content-Type': 'application/json', }, }) .then((res) => res.json()) .then((resData) => { return resData; }) .catch(error => console.log(error))};export { getbannerdata }
Image component
const BannerItem = ({ item }) => { console.log({item}) return (<View style={styles.cardView}><Image style={styles.Image} source={{ uri: item.header }} /><View style={styles.textView}><Text style={styles.itemTitle}>{item.title}</Text><Text numberOfLines={2} style={styles.itemDescription}>{item.content}</Text></View></View> )
info.plist
<dict><key>NSAllowsArbitraryLoads</key><true/><key>NSExceptionDomains</key><dict><key>localhost</key><key>192.168.178.46:8000</key><dict><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict></dict></dict>