Ios WatchKit-无法在后台传输文件”;“未安装手表应用程序”;
我正在尝试使用WCSession方法transferFile在后台传输图像文件 我正在从PHPhotoLibrary(本地照片)中提取照片。然后将它们存储在缓存目录中,以便通过传输发送。图像已成功写入并保存到该位置Ios WatchKit-无法在后台传输文件”;“未安装手表应用程序”;,ios,swift,watchkit,watchconnectivity,Ios,Swift,Watchkit,Watchconnectivity,我正在尝试使用WCSession方法transferFile在后台传输图像文件 我正在从PHPhotoLibrary(本地照片)中提取照片。然后将它们存储在缓存目录中,以便通过传输发送。图像已成功写入并保存到该位置 let manager = PhotoManager() manager.requestPhotos { (error) in if error == nil { if let fileURLs = manager.findFilesI
let manager = PhotoManager()
manager.requestPhotos { (error) in
if error == nil {
if let fileURLs = manager.findFilesInCache() {
for file in fileURLs {
print(file)
self.session.transferFile(file, metadata: nil)
}
}
}
}
}
手表的侧面:
func applicationDidFinishLaunching() {
// Perform any final initialization of your application.
//Initialize the WCSession
if (WCSession.isSupported()) {
WCSession.defaultSession().delegate = self;
WCSession.defaultSession().activateSession()
}
}
func session(session: WCSession, didReceiveFile file: WCSessionFile) {
print (file.fileURL)
}
然而,我不断地从didFinishFileTransfer得到这个错误
"Error Domain=WCErrorDomain Code=7006 \"Watch app is not installed.\" UserInfo={NSLocalizedRecoverySuggestion=Install the Watch app., NSLocalizedDescription=Watch app is not installed.}"
我什么都试过了。重新安装应用程序,重建项目。重新打开Xcode。重新连接我的手表。。。。我要试着重新启动我的电脑
你知道我为什么会犯这个错误吗 你是否进入手机上的Watch应用程序并添加了你的应用程序?嗯,通过Xcode它安装得很好。但通过Watch应用程序安装它时失败。应用程序是否显示在手表上?仅当其在xcode中构建并运行时。我无法获取“Apple Watch上的Show App”来安装该应用程序。它安装了大约一半,然后崩溃了@MileSpery您应该修复watch应用程序安装问题,因为这是产生此问题错误消息的合理原因。您可以查看手表的控制台日志以了解更多详细信息,可以在Xcode->Window->Devices中找到。