Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is my two cents on the issue. I tried what dtrotzjr recommended and didn't have a whole lot of success. It seems that removeUbiquitousContentAndPersistentStoreAtURL:options:error: is great for clearing out data in a UIManagedDocument, but the Logs folder is still there and so are the remnants of the file I'm trying to delete. Here is a simpler method for completely deleting a UIManagedDocument from iCloud or Local Docs:</p> <pre><code>+ (void)deleteDocumentURL:(NSURL *)url{ //if we have an iCloud Document, remove it from the UbiquitouseKeyValueStore if ([self isiCloudURL:url]) { [[NSUbiquitousKeyValueStore defaultStore] removeObjectForKey:[url lastPathComponent]]; } //do the delete on another thread dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil]; NSError *coordinationError; [coordinator coordinateWritingItemAtURL:url options:NSFileCoordinatorWritingForDeleting error:&amp;coordinationError byAccessor:^(NSURL *newURL) { NSError *removeError; //code for performing the delete [[NSFileManager defaultManager] removeItemAtURL:newURL error:&amp;removeError]; //if we have an iCloud file... if ([self isiCloudURL:url]) { //remove log files in CoreData directory in the cloud NSURL *changeLogsURL = [[self urlForiCloudLogFiles] URLByAppendingPathComponent:[url lastPathComponent]]; [[NSFileManager defaultManager] removeItemAtURL:changeLogsURL error:&amp;removeError]; } }]; }); } </code></pre> <p>This is pretty much the code from Stanford's CS193 course 2012 + the delete for the changeLogs folder and it works on local and iCloud docs. Please let me know if you see any issues with performing the delete this way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload