微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

swift – WKRefreshBackgroundTask尝试访问文件时出错bktasksnapshot_(null)

在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.")
        }
    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐