在watchOS 4.0(
Xcode 9.0 beta 6)中执行后台任务时,我收到类似于下面的错误消息.它们似乎没有引起任何问题,但我不确定.有没有人知道是什么导致这些错误被记录,如果有修复或方法来抑制它们?
2017-08-24 09:03:40.130009-0400 cfanow Watch App Extension[6906:377766] [bg_app_refresh] -[WKRefreshBackgroundTask cleanupStorage]_block_invoke:213: Error attempting to reach file:///Users/justindomnitz/Library/Developer/CoreSimulator/Devices/264AA014-FD6C-426A-88DF-64E502393BAF/data/Containers/Data/PluginKitPlugin/107681EE-B30E-49CD-9416-8F030D1CA0BF/Library/com.apple.watchkit/bktasksnapshot_(null): Error Domain=NSCocoaErrorDomain Code=260 “The file “bktasksnapshot_(null)” couldn’t be opened because there is no such file.” UserInfo={NSURL=file:///Users/justindomnitz/Library/Developer/CoreSimulator/Devices/264AA014-FD6C-426A-88DF-64E502393BAF/data/Containers/Data/PluginKitPlugin/107681EE-B30E-49CD-9416-8F030D1CA0BF/Library/com.apple.watchkit/bktasksnapshot_(null),NSFilePath=/Users/justindomnitz/Library/Developer/CoreSimulator/Devices/264AA014-FD6C-426A-88DF-64E502393BAF/data/Containers/Data/PluginKitPlugin/107681EE-B30E-49CD-9416-8F030D1CA0BF/Library/com.apple.watchkit/bktasksnapshot_(null),NSUnderlyingError=0x79f3f3c0 {Error Domain=NSPOSIXErrorDomain Code=2 “No such file or directory”}}
我遇到了同样的问题,在你的句柄(_)方法中安排快照.优选地,当任务完成或您有要展示的东西时.
WKExtension.shared().scheduleSnapshotRefresh(withPreferredDate: fireDate,userInfo: nil) { error in
if (error == nil) {
print("successfully scheduled snapshot. All background work completed.")
}
}