WatchKit 2 Complication Text Only Shows Up in Preview

I’m trying to develop a very simple complication for watchkit2 that says “Hi” from a simple text provider.

I’ve managed to achieve some strange behavior; I can see the text when the complication is clicked or when you are previewing it from the customize watchface screen, but not when the watchface is displayed. Have a look:

  • How to share data using Watch Connectivity when working with Core Data
  • Are iPhone's apps notifications going to be triggered on the Apple Watch by default, without even creating an actual Watch app?
  • Using WCSession with more than one ViewController
  • Check if iPhone is paired with apple watch?
  • prepareForSegue equivalent in WatchKit
  • iOS7 and Apple Watch
  • watchface behaviing strangely gif

    Any ideas what might be causing this?

    My text provider looks like this

    var textProvider: CLKSimpleTextProvider
    
    override init() {
    
        textProvider = CLKSimpleTextProvider()
        textProvider.text = "Hi"
        textProvider.shortText = "HI"
        textProvider.tintColor = UIColor.whiteColor()
        super.init()
    }
    

    And my get getPlaceholderTemplateForComplication looks like

    func getPlaceholderTemplateForComplication(complication: CLKComplication, withHandler handler: (CLKComplicationTemplate?) -> Void) {
        // This method will be called once per supported complication, and the results will be 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)
        }
    
    }
    

    Solutions Collect From Internet About “WatchKit 2 Complication Text Only Shows Up in Preview”

    While customizing watch face, Apple Watches calls getPlaceholderTemplateForComplication:withHandler: to show placeholder text. Since you’ve implemented it – you can see “Hi”. That is cool.
    But when watch face displayed, it calls another methods, such as:

    • getCurrentTimelineEntryForComplication:withHandler:
    • getTimelineEntriesForComplication:beforeDate:limit:withHandler:
    • getTimelineEntriesForComplication:afterDate:limit:withHandler:

    And it seems like you’re not implemented them. So implementing these method will resolve your issue.
    You can find more detailed information about these methods in this WWDC 2015 Tutorial: https://developer.apple.com/videos/wwdc/2015/?id=209