Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete All Files is not working #94

Open
Tejas-narola opened this issue Mar 29, 2016 · 1 comment
Open

Delete All Files is not working #94

Tejas-narola opened this issue Mar 29, 2016 · 1 comment

Comments

@Tejas-narola
Copy link

Tejas-narola commented Mar 29, 2016

We have one feature of iCloud backup. When I try to delete all file after upload file, it is working perfectly but when I try to delete all files after downloading file, delete is not working.

Download code:

[[iCloud sharedCloud] retrieveCloudDocumentWithName:filename completion:^(UIDocument *cloudDocument, NSData *documentData, NSError *error) {
    if (!error)  {
        NSData *fileData = documentData;
        NSError *err = nil;
        NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:fileData options:0 error:&err];
        [cloudDocument closeWithCompletionHandler:^(BOOL success) {
            if (success) {
            }
        }];
    }
}];

Delete all Files from iCloud:

[[[iCloud sharedCloud]listCloudFiles] enumerateObjectsUsingBlock:^(NSString *listname, NSUInteger idx, BOOL *stop) {
    if ([listname isKindOfClass:[NSURL class]]) {
        listname = [listname lastPathComponent];
    }

    [[iCloud sharedCloud] deleteDocumentWithName:listname completion:^(NSError *error) {
        if (error) {
        } else {
            [[iCloud sharedCloud] updateFiles];
            int value =   (int)[[iCloud sharedCloud]listCloudFiles].count;
            if (!error && value == 0) {
            } else if(error && value == 1) {
            }
        }
    }];
}];

Any idea what I might be missing?

@Tejas-narola
Copy link
Author

Tejas-narola commented Apr 4, 2016

Please help me out... I've been stuck on this issue for the last two weeks and couldn't find any feasible solution.

@Sam-Spencer Sam-Spencer added this to the Triage milestone Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants