storyboard has question marks for every image after I imported into xcassets
Asked Answered
B

3

7

all images in my storyboard are now ? images. This happened after I imported all media assets into a new .xcassets structure. The app runs fine and the images show when the app runs, but what can I do to restore them in the storyboard?

Buttery answered 6/11, 2013 at 18:40 Comment(0)
B
10

Remove the .png extension from the image names in the storyboard. Xcode5 now uses the image name, not the filename.

Breakage answered 6/11, 2013 at 18:46 Comment(0)
P
1

Try first to do a clean build. In a project including git repo I was facing this problem. It solved each time by just by clean building the folder:

⇧⌘K
or
Product-> Clean build folder

Pebble answered 21/10, 2018 at 11:41 Comment(0)
M
0

It's likely that the accepted answer will solve the problem. However, in the event that you're still scratching your head:

If you have a naming convention for assets that involves "." characters (for example, "icon.menu.normal.png"), you will find that XCode and IB will very happily cooperate before using .xcassets. If you then shift everything into .xcassets, you will find that all of a sudden:

  • IB will show the images correctly provided you leave off the file extension. However, when the app runs, none of IB's correctly visible images will load;
  • If you include the file extension in IB, IB will display them as broken question marks but they will display correctly in the app.
  • If you use imageNamed: you find you need to include the file extension for assets, otherwise northing happens.

The solution? Don't use "." in your asset naming conventions (bad programmer). Using underscores ("_") works fine too, is just as legible and saves you a lot of hassle.

Mariano answered 6/4, 2014 at 15:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.