从另一个手表套件应用程序中启动手表套件应用程序

Launch watch kit app from within another watch kit app

我知道 phone 可以使用类似...

从另一个应用程序中启动一个应用程序
-(IBAction) openYoutube:(id)sender {
      UIApplication *ourApplication = [UIApplication sharedApplication];
      NSString *ourPath = @"http://www.youtube.com/watch?v=TFFkK2SmPg4";
      NSURL *ourURL = [NSURL URLWithString:ourPath];
      [ourApplication openURL:ourURL];
}

这将启动 youtube 应用程序

我的研究没有带来任何有用的结果,我怀疑那里有什么东西,但是要求确定有什么坏处。有没有办法从 Apple Watch 实现这种功能?就像用户点击按钮一样,我希望我的手表套件应用程序启动 instagram 或 Twitter 手表套件应用程序

幸运的是,你可以。您可以要求 iOS 应用程序执行此操作。使用这个方法

[WKInterfaceController openParentApplication:@{[results firstObject]:[results firstObject]} reply:^(NSDictionary *replyInfo, NSError *error) {
    }];

调用您的 parent iOS 应用程序。在 iOS 应用程序中,实现此委托方法以实现您想要的(在您的 AppDelegate 中)。

(void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply{}