【问题标题】:'openParentApplication(_:reply:)' has been explicitly marked unavailable here - Xcode 7 Beta'openParentApplication(_:reply:)' 已在此处明确标记为不可用 - Xcode 7 Beta
【发布时间】:2015-08-29 12:50:25
【问题描述】:

更新到 Xcode 7 beta 后,我在运行代码行“WKInterfaceController.openParentApplication”时收到以下错误消息:“'openParentApplication(_:reply:)' 已在此处显式标记为不可用”

这是我的实际代码:

func getData(messageText: String) {
    let infoDictionary = ["message" : messageText]
    WKInterfaceController.openParentApplication(infoDictionary) {
        (replyDictionary, error) -> Void in

        if let castedResponseDictionary = replyDictionary as? [String: String],
            responseMessage = castedResponseDictionary["message"]
        {
            print(responseMessage)
        }
    }
}

【问题讨论】:

标签: ios xcode swift watchkit beta


【解决方案1】:

+[WKInterfaceController openParentApplication:] 仅与 WatchKit1 应用扩展相关,因为使用 WatchKit1 应用扩展,appex 在手机而不是手表上运行。

使用 WatchKit2 应用程序扩展,appex 在手表上运行,因此此类操作不太容易完成。您可能想使用 WatchConnectivity.framework 中的-[WCSession sendMessageData:replyHandler:errorHandler:] 来完成您正在做的事情。

【讨论】:

  • 老兄,感谢您的回答,但我们需要一个教程。这是给对未来感兴趣的人的一个 --> kristinathai.com/…
猜你喜欢
  • 1970-01-01
  • 2021-12-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-12
  • 2015-10-19
  • 1970-01-01
相关资源
最近更新 更多