Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird warning in Xcode about fenceExemptQueue in iOS

Tags:

ios

When my app is going to background (right after applicationDidEnterBackground), the following warning appeared.

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

I cannot find any information about it on Google and have no idea why it is happening.

Does anyone know what it means? Thanks!

like image 436
He Yifei 何一非 Avatar asked Dec 11 '15 12:12

He Yifei 何一非


1 Answers

I got the same weird error message in a Swift program, and finally figured out what was wrong with my code. The correct code is:

    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()
}

In the code above, the correct format is "%K like 'savefile.txt'", but if you forget the single quotes around the file name, you get the strange runtime error message. Without the single quote around the filename, the metadata query fails to find your file on iCloud.

like image 184
Dave Wilson Avatar answered Oct 31 '22 09:10

Dave Wilson