【发布时间】:2017-08-14 08:59:34
【问题描述】:
假设我有一个专业版的 watchOS 应用,我想将用户重定向到 iPhone 上的 App Store。如何做到这一点?
我尝试使用WatchConnectivity。在 iOS 应用程序中,我有以下代码:
func session(_ session: WCSession, didReceiveMessage message: [String : Any]) {
if message[.openProAppOnAppstoreMessageKey] != nil {
// NOTE: Works only in foreground
UIApplication.shared.openURL(.proApp)
}
}
问题在于,这只有在 iOS 应用程序处于前台时才有效。在后台调用session(didReceiveMessage:)成功,但是openURL没有效果。
【问题讨论】:
标签: ios watchkit watchos watchos-3 watchconnectivity