打开父应用程序(WatchOS 2.x +)

我试图从父应用程序获取更新,但是当Apple Watch发送请求时,我不想将父应用程序放到前台。 我最终希望将父应用程序置于后台状态,让它运行所需的方法并将其发送回手表。

具体来说,有没有办法打开父应用程序,并让它暂时驻留在WatchOS 2.0 +的后台状态?

我已经看过这个:
[WKInterfaceController openParentApplication:[NSDictionary new] reply:nil];

但是,这显然无法启动Watch OS 2.0。

(家长应用)应用委托:

@interface InterfaceController() <WCSessionDelegate> @property (unsafe_unretained, nonatomic) IBOutlet WKInterfaceLabel *networkConnectionLabel; @end @implementation InterfaceController - (void)awakeWithContext:(id)context { [super awakeWithContext: context]; } - (void) willActivate { [super willActivate]; [self startSessionToParentDevice]; } - (void) startSessionToParentDevice { if ([WCSession isSupported]) { [[WCSession defaultSession] setDelegate: self]; [[WCSession defaultSession] activateSession]; } } - (void) session:(nonnull WCSession *)session didReceiveApplicationContext:(nonnull NSDictionary<NSString *,id> *)applicationContext { [[self networkConnectionLabel] setText: [applicationContext objectForKey:@"CurrentConnectionStatus"]]; } 

(Watch App)界面控制器:

 @interface InterfaceController() <WCSessionDelegate> @property (unsafe_unretained, nonatomic) IBOutlet WKInterfaceLabel *networkConnectionLabel; @end @implementation InterfaceController - (void)awakeWithContext:(id)context { [super awakeWithContext: context]; } - (void) willActivate { [super willActivate]; [self startSessionToParentDevice]; } - (void) startSessionToParentDevice { if ([WCSession isSupported]) { [[WCSession defaultSession] setDelegate: self]; [[WCSession defaultSession] activateSession]; } } - (void) session:(nonnull WCSession *)session didReceiveApplicationContext:(nonnull NSDictionary<NSString *,id> *)applicationContext { [[self networkConnectionLabel] setText: [applicationContext objectForKey:@"CurrentConnectionStatus"]]; } 

在手表端使用WatchConnectivity的sendMessage API来在后台唤醒iOS应用程序