Images not shown on Apple Watch
Asked Answered
S

6

22

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.

Seminar answered 20/4, 2015 at 6:12 Comment(0)
S
18

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---

  1. 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.

  2. They must be @2x named, yes.

  3. It's your best bet to store them in an asset catalog. Not sure reasoning on why you wouldn't.

  4. 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

Seminar answered 27/4, 2015 at 6:10 Comment(2)
not worked for me !!! :http://stackoverflow.com/questions/31168429/watchkit-image-not-showing-on-real-deviceAlmaalmaata
Jeez!!! Hey Apple, how about showing a warning, or at least stick your tongue out, about this?Mention
P
9

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

Pulmonic answered 20/4, 2015 at 10:15 Comment(2)
While image catalog are the easiest route - I still don't understand why people are reluctant to use them - that's not strictly true. My approved app uses a couple non-catalog images for specific reasons.Benzofuran
Yoru Approved Apple Watch App uses non-catalog images?Pulmonic
S
7

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.

folder tree

Sectionalism answered 11/4, 2016 at 20:27 Comment(1)
Is there a way to avoid duplications?Tugman
T
1

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)

        }
    }
This answered 4/8, 2015 at 16:10 Comment(0)
B
0

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.

Benzofuran answered 20/4, 2015 at 9:49 Comment(1)
Hi bgilham , my images are stored in WatchKit app's bundle & Interface builder showing it properly . Should I set the images programmatically like - setImageNamed: or setBackgroundImageNamed: methods as said by apple here - developer.apple.com/library/ios/documentation/General/…Seminar
F
0

Check the Resolution of the picture. I try 2 Picture and the lowest resolution display at least in the Apple Watch Emulation

Fotina answered 25/5, 2019 at 13:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.