Wassim Seifeddine
Wassim Seifeddine

Reputation: 1022

Xcode 9 not finding assets after using xcode 10

I downloaded Xcode 10 to test some new features on a project, Now when I reopen the same project on Xcode 9. It seems that Xcode can't find any assets ( images)

This would work fine on Xcode 10 :

let image = UIImage(named: "AsunnyDay")
// this would find the correct image

However, on Xcode 9

let image = UIImage(named: "AsunnyDay")
//image would be nil

I guess it's something related to XCode 10 categorizing the assets as either for dark appearance or light. but I don't understand why would Xcode 9 not find them.

Upvotes: 6

Views: 3133

Answers (3)

HardikDabhi
HardikDabhi

Reputation: 2952

Change your command line tool and clear your derived data first. Clear your project.

After that force quit Xcode and reopen it. It solved my assets warning problem.

enter image description here

Hope it will help you.

Upvotes: 0

Mohamed Ali
Mohamed Ali

Reputation: 273

For me i just reran the project using Xcode 10 and then reverted back to Xcode 9 and it worked for me.

Upvotes: 0

Wassim Seifeddine
Wassim Seifeddine

Reputation: 1022

Guys this is how I fixed it.

  1. Open project in Xcode 10 beta
  2. Go to the assets
  3. Select all the images you have
  4. In the inspector, you will have an option to choose the appearance type. Choose Any, Light,Dark Xcode 10 Appearance
  5. This will create extra placeholders for other images: Extra Assets
  6. Open Project in Xcode 9. the assets will look something like this Extra Assets
  7. Reorder the 1x , 2x , 3x into place. Reorder
  8. Delete the extra unassigned placeholders Final
  9. Done

Upvotes: 6

Related Questions