当我的应用程序进入后台时(applicationDidEnterBackground
之后),出现以下警告。
2015-12-11 20:54:43.661 AppName[759:124891] *|synchronize-skip|* a fence was started inside of a snapshot block - skipping the workspace synchronize because it may dequeue messages from the fenceExemptQueue and snapshots expect that not to happen
2015-12-11 20:54:44.084 AppName[759:124891] *|synchronize-skip|* a fence was started inside of a snapshot block - skipping the workspace synchronize because it may dequeue messages from the fenceExemptQueue and snapshots expect that not to happen
我在Google上找不到任何有关它的信息,也不知道为什么会这样。
有谁知道这意味着什么?谢谢!
答案 0 :(得分:1)
我在Swift程序中得到了同样奇怪的错误信息,最后弄清楚我的代码出了什么问题。正确的代码是:
override func viewDidLoad() {
super.viewDidLoad()
let fileMgr = NSFileManager.defaultManager()
ubiquityURL = fileMgr.URLForUbiquityContainerIdentifier(nil)
guard ubiquityURL != nil else {
print("Dave: Unable to access iCloud account")
return
}
ubiquityURL = ubiquityURL?.URLByAppendingPathComponent("Documents/savefile.txt")
metaDataQuery = NSMetadataQuery()
metaDataQuery?.predicate = NSPredicate(format: "%K like 'savefile.txt'", NSMetadataItemFSNameKey)
metaDataQuery?.searchScopes = [NSMetadataQueryUbiquitousDocumentsScope]
NSNotificationCenter.defaultCenter().addObserver(self, selector: "metadataQueryDidFinishGathering:", name: NSMetadataQueryDidFinishGatheringNotification, object: metaDataQuery!)
metaDataQuery!.startQuery()
}
在上面的代码中,正确的格式是"%K喜欢' savefile.txt'",但是如果你忘记了文件名周围的单引号,你会得到奇怪的运行时错误消息。如果没有围绕文件名的单引号,元数据查询将无法在iCloud上找到您的文件。