2
votes

I would like to show the Short-Look or Long-Look interfaces I created for my Apple Watch App.

What already works is the following:

The app does some background job and then notifies the user. This happens with a UILocalNotification.

When the iPhone is locked and the watch is around my arm, the watch will vibrate and show just a simple notification, but not the Long or Short-Look notification.

I saw that somebody got it working with push notifications -> Apple Watch: dynamic Long Look not shown, when push opened from Notification Center Currently my app does not support push.

Does anyone know a way to present Long or Short-Look notifications without a server that does the push stuff?

I send the notification with the following code:

    var localNotification =  UILocalNotification()
    //---the message to display for the alert---
    localNotification.alertBody =
    "You have entered the region you are monitoring"

    //---uses the default sound---
    localNotification.soundName = UILocalNotificationDefaultSoundName

    //---title for the button to display---
    localNotification.alertAction = "Details"
    //---display the notification---

    UIApplication.sharedApplication().presentLocalNotificationNow(localNotification)

Best regards,

Simon

2

2 Answers

1
votes

You have to set the 'category' property with value matching the one in the watch app storyboard.

0
votes

In your NotificationController.swift file (or whatever you may have named your custom WKUserNotificationInterfaceController class), did you uncomment the function "didReceiveLocalNotification" (it's commented out by default)? I don't think the watch will display a Short- or Long-Look notification otherwise.

EDIT: I was mistaken; that function only relates to the dynamic (Long-Look) interface, not the static interface. I'm not sure why the static interface wouldn't appear.