我刚刚在我的项目中添加了一个Watch应用程序并尝试:
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
let res = WKInterfaceController.openParentApplication(["key" : "value"]) { (replyInfo, error) -> Void in
print("replyInfo : \(replyInfo) + error \(error)")
}
print(res) // true here
}
Run Code Online (Sandbox Code Playgroud)
在我的AppDelegate中,我写道:
func application(application: UIApplication, handleWatchKitExtensionRequest userInfo: [NSObject : AnyObject]?, reply: ([NSObject : AnyObject]?) -> Void) {
reply(["replyKey" : "replyValue"]);
}
Run Code Online (Sandbox Code Playgroud)
当我启动Watch应用程序时,我只有:
replyInfo:[:] + error可选(错误域= FBSOpenApplicationErrorDomain Code = 3"操作无法完成.(FBSOpenApplicationErrorDomain eor 3.)")
是由于模拟器?你知道做错了什么吗?
谢谢 !