大佬教程收集整理的这篇文章主要介绍了ios – 从手表应用程序启动主机应用程序,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我也尝试使用NSExtensionContext的openUrl()api,如下所示:
NSExtensionContext *ctx = [[NSExtensionContext alloc] init]; NSURL *url = [NSURL URLWithString:@"myscheR_718_11845@e://today"]; [ctx openURL:url completionHandler:^(BOOL success) { NSLog(@"fun=%s after completion. success=%d",__func__,success); }]; [ctx completerequestReturningItems:ctx.inputItems completionHandler:nil];
主机应用程序也没有启动.我错过了什么吗?或者是不可能的
从手表套件扩展程序启动主机应用程序?
https://developer.apple.com/handoff/
在某个地方共享:
static let sharedUserActivityType = "com.yourcompany.yourapp.youraction" static let sharedIdentifierKey = "identifier"
在你的手表上
updateUserActivity(sharedUserActivityType,userInfo: [sharedIdentifierKey : 123456],webpageURL: nil)
在你的iPhone应用程序代表:
func application(application: UIApplication,willConTinueUserActivityWithType userActivityType: String) -> Bool { if (userActivityType == sharedUserActivityTypE) { return true } return false } func application(application: UIApplication,conTinueUserActivity userActivity: NSUserActivity,restorationHandler: ([AnyObject]!) -> Void) -> Bool { if (userActivity.activityType == sharedUserActivityTypE) { if let userInfo = userActivity.userInfo as? [String : AnyObject] { if let identifier = userInfo[sharedIdentifierKey] as? Int { //Do something let alert = UIAlertView(title: "Handoff",message: "Handoff has been @R_944_10296@gered for identifier \(identifier)",delegate: nil,cancelButtontitle: "Thanks for the info!") alert.show() return true } } } return false }
最后(这一步很重要!!!):在你的Info.plist
以上是大佬教程为你收集整理的ios – 从手表应用程序启动主机应用程序全部内容,希望文章能够帮你解决ios – 从手表应用程序启动主机应用程序所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。