If you ever need to access data or other content such as images, video, audio or other files that are NOT on an SSL secured (http://) website or web service, this guide will help you.
This is how I allow an iOS mobile app to connect to a non-https web api web service. (This is NOT SAFE and should only do this in development scenarios).
- In your Xamarin.Forms iOS project RIGHT CLICK and open the Info.plist file in an XML editor of choice. I use the XML (Text) Editor choice in Visual Studio for Windows.
- Towards the bottom of the .plist file BEFORE the ending tags
add the following code snippet.
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
- Save and close the info.plist file
This is how I allow an Android 9+ mobile app to connect to a non-https web api web service. (This is NOT SAFE and should only do this in development scenarios).
- In your Xamarin.Forms Android project open the Properties/AssemblyInfo.cs file
- Add the following code at the bottom of the file after the UserPermission code
[assembly: Application(UsesCleartextTraffic = true)]
- Save and close the file.