从另一个手表套件应用程序中启动手表套件应用程序 [英] Launch watch kit app from within another watch kit app

查看:24
本文介绍了从另一个手表套件应用程序中启动手表套件应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在电话上可以使用类似...的内容从另一个内部启动应用程序

I know on the phone it is possible to launch an application from within another using something along the lines of...

-(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 应用

This will launch the youtube app

我的研究没有产生任何有用的东西,我怀疑那里有什么东西,但要求确定有什么害处.反正有没有办法从苹果手表完成这种功能?就像用户点击按钮一样,我希望我的手表套件应用程序启动 instagram 或 twitter 手表套件应用程序

My research hasn't led to anything useful and I doubt there is something out there, but what's the harm in asking to be sure. Is there anyway to accomplish this sort of functionality from the apple watch? Like if the user hits a button, I want my watch kit app to launch the instagram or twitter watch kit app

推荐答案

幸运的是,您可以.您可以要求 iOS 应用执行此操作.用这个方法

Fortunately, you can. You can ask the iOS app to do this. Use this method

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

调用您的父 iOS 应用.在 iOS 应用中,实现此委托方法以实现您想要的(在您的 AppDelegate 中).

To call your parent iOS app. Within the iOS app, implement this delegate method to achieve what you want (in your AppDelegate).

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

这篇关于从另一个手表套件应用程序中启动手表套件应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆