【发布时间】:2015-06-15 08:11:25
【问题描述】:
我有一个用于 Apple Watch 通知的简单静态接口,如下所示:
并且在 PushNotificationPayload 中如下:
{
"aps": {
"alert": {
"body": "123You have a new message",
"title": "myApp"
},
"category": "respond"
},
"WatchKit Simulator Actions": [
{
"title": "View Message",
"identifier": "viewMsgBtn"
}
],
"customKey": "customKey"
}
并在InterfaceController中实现方法
- (void)handleActionWithIdentifier:(NSString *)identifier
forRemoteNotification:(NSDictionary *)remoteNotification
{
NSLog(@"Handling remote notification: %@ with identifier: %@", remoteNotification, identifier);
// [self.lbTest setText:[NSString stringWithFormat:@"Notification: %@",remoteNotification.description]];
}
然后我运行带有通知的模拟器:
InterfaceController 中的 awakeWithContext 方法被调用,点击 View Message 按钮后,它会加载到我的 Apple Watch 应用界面。
InterfaceController 中的 willActivate 方法被调用。 但是没有调用用于RemoteNotification 的handleActionWithIdentifier ... 有什么想法吗?
【问题讨论】:
-
遇到了类似的问题,请问您解决这个问题了吗?
-
不...还是不知道...
-
你有没有弄清楚问题是什么?
标签: push-notification apple-watch