swift - WatchKit 2 Complication Text Only Shows Up in Preview -


i'm trying develop simple complication 2 says "hi" simple text provider.

i've managed achieve strange behavior; can see text when complication clicked or when previewing customize watchface screen, not when watchface displayed. have look:

watchface behaviing strangely gif

any ideas might causing this?

my text provider looks this

var textprovider: clksimpletextprovider  override init() {      textprovider = clksimpletextprovider()     textprovider.text = "hi"     textprovider.shorttext = "hi"     textprovider.tintcolor = uicolor.whitecolor()     super.init() } 

and getplaceholdertemplateforcomplication looks like

func getplaceholdertemplateforcomplication(complication: clkcomplication, withhandler handler: (clkcomplicationtemplate?) -> void) {     // method called once per supported complication, , results cached       switch complication.family {      case .modularsmall:         let stemplate = clkcomplicationtemplatemodularsmallsimpletext()         stemplate.tintcolor = uicolor.whitecolor()         stemplate.textprovider = textprovider         handler(stemplate)      case .circularsmall:         let stemplate = clkcomplicationtemplatecircularsmallsimpletext()         stemplate.tintcolor = uicolor.whitecolor()         stemplate.textprovider = textprovider         handler(stemplate)      default:         handler(nil)     }  } 

while customizing watch face, apple watches calls getplaceholdertemplateforcomplication:withhandler: show placeholder text. since you've implemented - can see "hi". cool. when watch face displayed, calls methods, such as:

  • getcurrenttimelineentryforcomplication:withhandler:
  • gettimelineentriesforcomplication:beforedate:limit:withhandler:
  • gettimelineentriesforcomplication:afterdate:limit:withhandler:

and seems you're not implemented them. implementing these method resolve issue. can find more detailed information these methods in wwdc 2015 tutorial: https://developer.apple.com/videos/wwdc/2015/?id=209


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -