Images not showing in iOS 7.1 with XCode 6 / Swift

ios7, swift, xcode

Solution

I've managed to overcome this by not using Asset Libraries to store my images.

Add your images to the project using the "old style naming", like Image.png and Image@2x.png, then load them without any extensions in the filename, as such:

let myImage = UIImage(named:"Image")

Problem

I have this ObjC code: ``` [self.myButton setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@-button", self.myObject.name]] forState:UIControlStateNormal]; ``` This works great with these combinations: - XCode 5, iOS 7.1 - XCode 6, iOS 7.1 - XCode 6, iOS 8 But when I port one single class of the project to Swift -- a class which is unrelated to anything that is happening in this code -- the images do not display in XCode 6 for iOS 7.1. It does work with XCode 6 and iOS 8. I finished porting the entire project to Swift, so now the code looks like: ``` self.myButton.setBackgroundImage( UIImage(named:self.myObject.name + "-button"), forState: UIControlState.Normal ) ``` And it's still unhappy on iOS 7.1. Still no images. (The custom icon works, though.) Yes, I know this is just beta software, and it's probably just a bug ... ? But I'm just wondering if anyone has a solution or insight. I only started using XCode and ObjC about a week ago (surprise! ObjC is now deprecated!), so it could be that I am missing something, but since it works in ObjC, and in Swift+iOS8, it seems like it's probably a bug.

Original source

Related problems