应用程序打开时手表无法接收通知
Watch can't receive notifications when app is open
最近在iWatch上做一个app,发现如果只实现方法:
- (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void (^)(WKUserNotificationInterfaceType))completionHandler
对于手表端的远程通知(扩展),我的应用打开时收不到通知。
这样的情况正常吗?如果iWatch是正常的,APNs会在应用关闭后稍后发送通知吗?
您可以使用 WCSessionDelegate
的委托方法
- (void)session:(WCSession *)session didReceiveMessage:(NSDictionary *)message{
NSLog(@"%@",[message objectForKey:@"<<"your key">>"]); }
最近在iWatch上做一个app,发现如果只实现方法:
- (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void (^)(WKUserNotificationInterfaceType))completionHandler
对于手表端的远程通知(扩展),我的应用打开时收不到通知。
这样的情况正常吗?如果iWatch是正常的,APNs会在应用关闭后稍后发送通知吗?
您可以使用 WCSessionDelegate
的委托方法
- (void)session:(WCSession *)session didReceiveMessage:(NSDictionary *)message{ NSLog(@"%@",[message objectForKey:@"<<"your key">>"]); }