我在我的应用程序中使用 watchkit。我想通过watchkit在iphone中打开应用程序。我搜索了很多但找不到任何东西。任何帮助将不胜感激。
我也尝试过下面的链接 How can I open the parent app on iPhone from my WatchKit app?
最佳答案
如果您使用 Objective C,则只需将以下方法放入 AppDelegate.m
文件中即可。
- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply {
NSString * request = [userInfo objectForKey:@"requestString"];
if ([request isEqualToString:@"executeMethodA"]) {
// Do whatever you want to do when sent the message. For instance...
//[self executeMethodABC];
}
reply(@{@"clicked from watch":@(1)});
}
希望这对您有帮助。
关于ios - 如何从 WatchKit 应用程序打开 iPhone 上的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36131148/