11

I'm trying to run an iOS7 project under Xcode6 on an iOS7 device. At first all seemed to be A-OK, but then I noticed that all images that reside in Images.xcassets don't show up at runtime.

I can see then correctly in design (storyboard), and I see them if I run the app in the simulator.

Anyone having an idea how to fix this? Thanks!

NOTE: the project runs fine on Xcode5.x therefore it's not the usual culprit (mismatch in the image name "casing").

ADDITIONAL NOTE: I've just tried with another iOS7 project: same problem...

ADDITIONAL NOTE: I've tried using image assets in a brand new project created under Xcode and... images show up.

4
  • Anyone with a similar experience?... Commented Jun 5, 2014 at 18:01
  • 1
    Yeah, the iOS 7 project loads fine in Xcode 6, and the iOS 8 Simulator shows my images fine. But on my device (running iOS 7.1), images don't show up! Commented Jun 11, 2014 at 20:53
  • @oKBo Thanks for confirming I am not alone. I was beginning to feel paranoiac :) Commented Jun 11, 2014 at 21:00
  • np, I noticed that when you drag a new image to images.xcassets, it doesn't show 1x 2x anymore, it only shows universal (1 slot for the image). I created a new project in Xcode 6, set the deployment target to 7.1, and dragged a new .PNG image into Images.xcassets, then created a button on the default/existing storyboard VC, and got the exact same results! (Simulator works fine, Device doesn't show the image) Commented Jun 11, 2014 at 21:21

5 Answers 5

13

Something I found in the Xcode 6 Beta Release Notes:

Images from asset catalogs in projects with a minimum deployment target of iOS 7 or OS X 10.9 will be available when running on iOS 8 and OS X 10.10, but not iOS 7 and OS X 10.9.(17029658)

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for this information oKBo. Now we'll have to wait before converting iOS7 projects to Swift.
4

I had the same problem, I have noticed that if I move my images from Images.xcassets to the "Supporting Files" folder, the images show up on iOS7. I Hope this helps

8 Comments

Thanks for the reply. I've tried it (and cleaned/closed/reopened everything several times but... to no avail :( It there something else you did besides moving Images.xcassets? Something benign but that could be the key? Bye
what's funny is: the app icon and the launch image do work... but none of the other images...
Yup... having the same issue. Bug.
Are you including the image's extension in the image name?
Try including the image's extension, you can create a simple app to test it, that's what I did and it's working fine.
|
4

I suddenly add jpg image to Image Assets. When resaved in png, all work OK

1 Comment

Same for me. Swapping out jpg for png fixed the issue.
2

Great find @o KB o! I've also found it surprisingly hard to get rid of asset bundles in my project when switching away from asset bundles and including images directly in my project.

Here's my full workaround:

  1. Copy each image out of your .xcassets image bundle to a new directory (let's call it Images/). See below for a script to make this easier.
  2. Delete your .xcassets bundle. (surprisingly, removing it from the project isn't enough. In my testing, if the .xcassets bundle was anywhere in the same directory as the Xcode project or related sources, it would get copied in. Alternately, you can remove the .xcassets extension)
  3. Add all your image files in Images/ to your Xcode project
  4. Clean (cmd + shift + k)
  5. Delete the app from the target device or simulator
  6. Install and run

To make step #1 less tedious, I wrote a script to copy images out of the .xcassets bundle and into a directory of your choice: https://github.com/johnboiles/xcasset_exporter

mkdir Images ./xcasset_exporter.py MyProject/Images.xcassets Images 

2 Comments

I can confirm that this worked for me. Tested on iPad mini retina 7.1.2 (11D257) Xcode Version 6.0 (6A215l)
Hey, this seems cool. I'm (seemingly) randomly getting the error "...line 29, in export_asset_bundle if image['scale'] == '2x': KeyError: 'scale'" Any idea why and how I can solve that?
2

I've just read about Xcode 6 beta 2: the problem will be fixed.

Downloading it as I'm writing :)

1 Comment

What happened? I'm on Xcode 6 b2 and still same problem

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.