'openParentApplication(_:reply :)'在这里明确标记为不可用 - Xcode 7 Beta

Avi*_*viv 13 beta xcode ios swift watchkit

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

这是我的实际代码:

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)
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Jer*_*oia 16

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

使用WatchKit2应用扩展程序,appex正在手表上运行,因此这样的操作不那么容易实现.您可能希望从WatchConnectivity.framework中使用- [WCSession sendMessageData:replyHandler:errorHandler:]来处理您正在做的事情.