samedi 6 juin 2015

How can I instantiate `WKInterfaceImage` object in a unit test?

I am trying to write a unit test for my WatchKit code using XCTest. The problem is that I can not instantiate WKInterfaceImage object in a unit test. The WKInterfaceImage() returns nil.

func testExample() {
  let image = WKInterfaceImage()
  image.setImage(UIImage()) // image is nil
}

unexpectedly found nil while unwrapping an Optional value

How can I instantiate WKInterfaceImage object in a unit test?

Aucun commentaire:

Enregistrer un commentaire