我想要显示用户在Apple Watch上收到的文本的简要摘要。然后,他们可以通过点击iWatch App中的按钮来阅读其iPhone上的文本。我不认为这是现在可能的,但如果是这样,请让我知道我需要做什么才能做到这一点。是否可以使用Apple Watch打开iPhone App?
1
A
回答
2
您可以在后台与
+ (BOOL)openParentApplication:(NSDictionary *)userInfo
reply:(void (^)(NSDictionary *replyInfo,
NSError *error))reply
打开您的iOS应用iOS应用会得到
- (void)application:(UIApplication *)application
handleWatchKitExtensionRequest:(NSDictionary *)userInfo
reply:(void (^)(NSDictionary *replyInfo))reply
所以,如果您的iOS应用程序已经在运行,你可以使用这个信息提供给应用程序。但是,您不能让iOS应用程序在前台运行,必须由用户启动。您可以将文本的其余部分保存到共享设置中,并/或在后台将其传递到您的应用程序openParentApplication
。然后,当用户打开你的iOS应用程序时,你可以向他们展示文本的其余部分。
0
不,不可以通过手表在iPhone上打开您的应用程序,但是您可以在后台打开您的应用程序。
假设您想要查看手表上的新闻,并且需要数据。你得到的是通过iPhone应用程序与数据:openParentApplication:
和handleWatchKitExtensionRequest:
如何做到这一点是在这个答案解释: How to send data from iphone to watchkit in swift
1
如果您需要在前台打开你的父应用程序,使用切换!
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 triggered for identifier \(identifier)" , delegate: nil, cancelButtonTitle: "Thanks for the info!")
alert.show()
return true
}
}
}
return false
}
最后(这一步是很重要!!!):在你的Info.plist(S)
相关问题
- 1. Objective-C HealthKit确定源是否来自Apple iPhone或Apple Watch
- 2. Apple Watch是否支持AVAudioSession?
- 3. 我们是否针对Apple Watch使用iOS 8.2或8.3开发?
- 4. 当iPhone解锁时,是否可以通过震动来通知Apple Watch?
- 5. URL方案打开Watch应用程序配对Apple Watch
- 6. 打开Apple TV App Store
- 7. 如何判断通知是否可以发送给Apple Watch?
- 8. 是否可以特别向Apple Watch发送本地通知?
- 9. 是否可以播放存储在Apple Watch上的音乐?
- 10. 你可以用Apple Watch的Parse SDK吗?
- 11. 是否可以在后台使用Apple Watch录制音频(屏幕关闭)?
- 12. iPhone是否“可以使用”?
- 13. 有没有办法检测Apple Watch是否与iPhone配对?
- 14. Apple Watch“请勿打扰”
- 15. Apple watch - 以编程方式打开地图
- 16. 从Watch App打开Safari iOS应用程序
- 17. Apple Watch应用程序可以与Apple TV进行交互吗?
- 18. Apple Watch上立即可以看到?
- 19. Apple App可以被非Apple应用程序使用吗?
- 20. 是否所有的iOS框架和类都可以在Watch App Extension中使用?
- 21. 是否可以在后台使用WatchConnectivity
- 22. 只有在Apple Watch和iPhone都锁定的情况下才可以通知Apple Watch吗?
- 23. 是否可以将Apple Direction API与Apple Maps一起使用?
- 24. 你可以在应用中使用Apple Watch Crown吗?
- 25. 使用CoreBluetooth检测Apple Watch
- 26. Apple Pay不可用于“APP”
- 27. 我如何获得REAL Apple Watch打开父应用程序
- 28. 在Apple Watch上显示iPhone的电池
- 29. 我可以在iPhone和Apple Watch之间用watchOS 2发送UIImage多快?
- 30. 当iPhone被锁定时,非原生Apple Watch应用程序可以工作吗?
Apple关注不有Handoff。它是iOS和OS X功能。 – 2015-04-18 14:07:42
我不能谈论它,但请相信我:您可以从手表切换到其他Apple设备。 – stk 2015-04-18 18:05:37