Reputation: 3588
My Apple Watch app images showing properly on Apple Watch Simulator,Like on menu modules menu images showing properly on simulator.
I uploaded my application on iTunes store , Apple Reviewed app & failed it by saying menu images are not showing on Apple Watch.
Any Idea why menu images are not showing on actual Apple Watch while it is showing on Apple Watch Simulator .
I set menu images directly from storyboard . Should i set Images from programmatically ? please help me.
Upvotes: 22
Views: 8005
Reputation: 181
Check the Resolution of the picture. I try 2 Picture and the lowest resolution display at least in the Apple Watch Emulation
Upvotes: 0
Reputation: 1842
We have two Assets.xcassets file. One of them is for Interface.storyboard and bundle Watch app. The second of them is the bundle Extension. If you setImage from code, You should have this image in the bundle Extension.
Upvotes: 7
Reputation: 7415
When You use Images in Code. There’s one small problem with using the UIImage(named:) initializer. It only looks in the local bundle. We’ll need to load these images into the Images.xcassets for the extension. The ones in the WatchKit App folder we made last time wont reach here.
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
enum GrossMarket: Int{
case egg = 1
case apple = 2
case orange = 3
}
//preload images
let egg = UIImage(named: "egg")
let apple = UIImage(named: "apple")
let orange = UIImage(named: "orange")
}
func updateDisplay(activity:Activites){
switch activity{
case .egg:
statusImage.setImage(egg)
case .apple:
statusImage.setImage(apple)
case .orange:
statusImage.setImage(orange)
default:
statusImage.setImage(orange)
}
}
Upvotes: 1
Reputation: 3588
Thanks for quick help ! everyone is right we should prefer to use Asset Catalog , I would like to share step by step solution of this issue that I got from apple developer forum given by behrens---
If the images are static resources that you already have, they should reside in the WatchKit app bundle. If they're dynamic, you can set them from the WatchKit extension at runtime.
They must be @2x named, yes.
It's your best bet to store them in an asset catalog. Not sure reasoning on why you wouldn't.
If you expand the attributes inspector, you can narrow the support for the image in the asset catalog to Apple Watch only. If you only have one version, drop it in the 2x bucket. If you have device-size specific images, drop them accordingly and I would add the 38mm sized image to the 2x bucket for a fallback.
For more details please visit the link - link
Upvotes: 18
Reputation: 5936
Your images have to be in an Asset Catalog to display on the device for Apple Watch
https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/Recipe.html
Upvotes: 9
Reputation: 5939
Are your images stored in your WatchKit app's bundle? Unfortunately, interface builder allows you to select an image from any bundle, but only images stored in your WatchKit app's bundle - or transmitted by your extension - will be visible when run on hardware.
Upvotes: 0