BeranekCZ
BeranekCZ

Reputation: 29

Xamarin forms - iOS: Images not visible on real device but visible on emulator

I made app from Visual studio Xamarin.Forms Shell template. I added local images to android(drawable folders) and iOS project (assets catalog). In Android is everything OK. But in iOS project is image visible only in iPhone simulator. Image does not show on real device (iPhone). And I don´t know where is problem. I am using Xamarin.Form 4.8

Images in assets catalog

Item detail page with included image.

 <StackLayout Spacing="20" Padding="15">
    <Image Source="baseline_home_black_48.png" HeightRequest="100" WidthRequest="100"></Image>
    <Image Source="baseline_home_black_48"  HeightRequest="100" WidthRequest="100"></Image>
    ...
</StackLayout>

Link to download project

Upvotes: 1

Views: 1188

Answers (3)

mtanksl
mtanksl

Reputation: 601

Short answer: You need to connect the iPhone/iPad direct to the MacBook for debugging.

--

Long answer: There are two ways to debug a Xamarin Forms iOS app:

  1. Connect iPhone/iPad to a PC using a cable. When using this option, no launch icon and no icons from the Asset Catalog will be shown. This is super frustrating, and the only thing I could find is this footnote by Microsoft:

"Limitations Asset Catalogs are currently not supported. When using Hot Restart, your app will show the default icon and launch screen for Xamarin apps. When paired to a Mac, or developing on a Mac, your Asset Catalogs will work."

from Xamarin Hot Restart

  1. Connect iPhone/iPad to a Macbook using a cable. When using this option, the launch icon and other icons from the Asset Catalog will be shown.

Remember that you need to allow trust access in the iPhone and enable Developer mode at Settings > Privacy and Security > Developer Mode > Enable. If the developer mode is not shown, you need to connect the cable first.

Upvotes: 0

Raghav
Raghav

Reputation: 1

HI In my case I was using two different systems to build the application. The image names contains - instead of _ once I correct it and include in the project it worked for me.

Have a great day.

Upvotes: 0

Full English
Full English

Reputation: 133

We had this issue and spent (wasted?) a few hours looking in to this.

Images were not appearing on real iOS devices (in debug) but were working fine for simulators. Local and remote images resulted in the same issue.

The issue appears to be a project setting.

Removal of --interpreter from the 'Additional mtouch arguments:' field seems to get it working. We believe the checkbox 'Enable the Mono interpreter' means the same thing and when checked images should still work and hot-reload too.

iOS Project settings for DEBUG

Upvotes: 1

Related Questions