tallpaul
tallpaul

Reputation: 1513

Images from Asset catalogs not loading on physical iPhone 5 but do show up on 6S and simulator

My app is loading images from an asset catalog.

I created the catalog by dragging and dropping in the Visual Studio editor.

When I load the app on a physical iPhone 6S, the simulator as a iPhone 6S or the simulator as a iPhone 5, the images display correctly.

When I load the app on a physical iPhone 5 none of them display.

In my project structure, all the images follow the same format:

Resources/Media.xcassets/Image1.imageset/image_1.png Resources/Media.xcassets/Image1.imageset/[email protected] Resources/Media.xcassets/Image1.imageset/[email protected]

and Resources/Media.xcassets/Image1.imageset/Contents.json is:

{
  "images": [
    {
      "scale": "1x",
      "idiom": "universal",
      "filename": "image_1.png"
    },
    {
      "scale": "2x",
      "idiom": "universal",
      "filename": [email protected]"
    },
    {
      "scale": "3x",
      "idiom": "universal",
      "filename": "[email protected]"
    }
  ],
  "properties": {},
  "info": {
    "version": 1,
    "author": ""
  }
}

I am loading them using UIImage.FromBundle("Image1");. The value is fine on the physical 6S and the simulator 5 but null on the physical 5.

I tried the deprecated method of adding image_test.png, [email protected] and [email protected] loosely in the Resources/ folder and these load fine on all platforms.

Any advice on where I'm going wrong? I'm confused because both of my devices should be using the same @2x images. I've deleted bin/iPhone/, cleaned and rebuilt numerous times with no luck.

Upvotes: 0

Views: 1063

Answers (1)

hvaughan3
hvaughan3

Reputation: 11105

Try uninstalling the application from the device completely. I find with sideloading, when you add or change images, this needs to be done along with possibly clearing the /bin/ and /obj/ folders and rebuilding the app, as you said you already did.

Most other times, this should not be necessary.

Upvotes: 1

Related Questions