Xamarin.Forms iOS images not showing

xamarin forms image from url not showing
xamarin forms image uri
xamarin forms download image from url
xamarin forms photo
xamarin forms icons resources
xamarin forms image viewer
xamarin forms image not load from url
xamarin image size

I have a Xamarin.Forms shared project. On Android all images work fine. I wanted to add them to my iOS project, but they don't show. I've added them to Assets.xcassets:

{
  "filename": "logo_launcher.png",
  "scale": "1x",
  "idiom": "universal"
}

And I use the following XAML:

<Image Source="logo_launcher.png" x:Name="logo" />

I've added all images except for the vector ones. I'm testing it on a iPhone 8 - 11.4 simulator.

Although it is deprecated, I tried to add the images to the "Resource" folder. But I couldn't even select the .png files. So that didn't work either.

I'm lost at what to do. Is there some option I need to enable, or something to include in the XAML to make it work?

Maybe I found a possible solution using Assets.xcassets, check the steps below:

  1. Main.xaml

    <Image x:Name="iconBrain">
        <Image.Source>
            <OnPlatform x:TypeArguments="ImageSource">
                <OnPlatform.iOS><FileImageSource File="IconBrain"/></OnPlatform.iOS>
                <OnPlatform.Android><FileImageSource File="ic_brain"/></OnPlatform.Android>
            </OnPlatform>
        </Image.Source>
    </Image>
    
  2. Android: Add the images on the respective Drawable folders under Resourses directory.

  3. iOS: Create a new Image Set under Assets.xcassets and add the Images.
  4. Done. No extra properties, configs, or xamarin tricks.

Check out my GitHub for the full solution, also I tried to reproduce the same environment w/ Xamarin.Forms, Shared Project and iPhone 8 - 11.4 simulator.

Another point, you can't add the images under mipmap directories, because the mipmap folders are for placing your app/launcher icons (which are shown on the homescreen) in only. Any other drawable assets you use should be placed in the relevant drawable folders as before.

It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density. - Google blogpost

Finally, thank you for the information about the deprecated approach by Apple.

Prior to iOS 9, images were typically placed in the Resources folder with Build Action: BundleResource. However, this method of working with images in an iOS app has been deprecated by Apple. For more information, see Image Sizes and Filenames. - Images in Xamarin.Forms

I hope this can help you.

How to show images in iOS, images not showing , I've created a xamarin forms PCL project. I'm showing images using. Device.​OnPlatform( iOS: ImageSource.FromFile("images/Govt_logo.png"),  This article covers including an image asset in a Xamarin.iOS app and displaying that image either by using C# code or by assigning it to a control in the iOS Designer. When adding an image for use in a Xamarin.iOS app, the developer will use an Asset Catalog to support every iOS device and resolution required by an app.

Check/Reproduce some steps below:

  1. Check the build action on your image resource, in shared PCL it should be Embedded Resource, in Android the build action should be AndroidResourceand BundleResource in iOS

  2. Try to set Copy to output directory to Always copy

  3. Delete bin/obj folders, switch build configuration from debug to release, rebuild project and then back to debug

  4. Try to delete the image from iOS, rebuild, re-add again, and then repeat the steps above

Also, you can try to set the ImageSource as you can see below:

<Image x:Name="logo"> 
    <Image.Source> 
        <OnPlatform x:TypeArguments="ImageSource"> 
            <On Platform="Android" Value="logo_launcher.png"/>
            <On Platform="iOS" Value="logo_launcher"/>
        </OnPlatform> 
    </Image.Source> 
</Image>

I hope this can help you.

Xamarin.Forms - iOS, Description I wanted to use one name for image resources in Xamarin Forms for Android and iOS, so I've created ImageSet with name  While not related to the Image view, application icons and splash screens are also an important use of images in Xamarin.Forms projects. Setting icons and splash screens for Xamarin.Forms apps is done in each of the application projects. This means generating correctly sized images for iOS, Android, and UWP.

Just select all images in resources folder in ios and right click-->build action-->bundle resource. It will work.

Image Not Showing In Xamarin Forms App, I add many image (png) to resource (both Android and IOS) and call that in my code. But when I deploy, the image not showing. I try to use the  Description. I wanted to use one name for image resources in Xamarin Forms for Android and iOS, so I've created ImageSet with name login_background.png in Assets.xcassets and placed there 3 background "Universal" images: login_background.png, login_background@2.png, login_background@3.png and in android drawable and drawable dpi versions with name login_background.png

Displaying images with Xamarin.iOS, This document describes how to display images in Xamarin.iOS. It covers adding images to an app either programmatically or through the iOS  After digging deeper into this, I noticed this is not only a problem for iOS, but Android aswell Background was Black, but image and button showed. However, setting the BackgroundColor of the ContentPage of one of the tabbed pages makes the page visible.

Xamarin Forms : Embeded Images not loading in Windows or iOS , I've tried running this in iOS, Windows and Android, the same resources are being loaded. Now, another weird issue. If I refer to these images as "MyApp.​images. Image Not Showing In Xamarin Forms App windows 10.0 Visual Studio 2017 version 15.2 xamarin Putri Elisabeth Sibuea reported Jun 20, 2017 at 09:10 AM

Introduction To Image Assets In Xamarin.Forms, While Xamarin Forms generally makes things pretty simple, there remain a This article is not meant as a replacement for Microsoft's own The various drawable folders each represent a different category of display density, starting with iOS Images 101 iOS has a similar approach to Android, but only  The only place to configure the app icons and splash screens (for iOS, UWP and not Android) is a platform-specific project, as the implementation for each platforms differs. The project created by the Xamarin Forms projects template in Visual Studio automatically adds the icon and splash-screen images, which look like the following, when we

Comments
  • Cannot comment but check this answer: stackoverflow.com/a/36798182/8057282
  • I've followed that, unfortunately that doesn't work for me.
  • There is a change I'm just stupid, but I'm not able to do step 1 and 2 on the assets.xcassets catalog. The other steps where not successful.
  • You don't need to use assets.Xcassets
  • Yes I do: "Prior to iOS 9, images were typically placed in the Resources folder with Build Action: BundleResource. However, this method of working with images in an iOS app has been deprecated by Apple. For more information, see Image Sizes and Filenames." docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/…
  • I didn't know, I will have a look. Tks bro
  • @TruffelNL please, check the possible solution that I found.