Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8634867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:49:34+00:00 2026-06-12T09:49:34+00:00

I’m programming a simple iCloud manager for some projects. Currently I have a small

  • 0

I’m programming a simple iCloud manager for some projects.

Currently I have a small test code to see if my manager successfully evicts files from the devices’ local storage (and does not delete them from iCloud storage). To do this, the documentation states that you use:

evictUbiquitousItemAtURL:error:

Removes the local copy of the specified cloud-based item.

My test snippet looks like this:

if ([self evictLocaleFile:@"myTestFile.txt"])
    NSLog(@"File was evicted successfully!");

[self listAllLocalFiles];

The idea here being that I first evict the specified file, then list the local files in the local iCloud folder to see if it’s still there or not.

The first method simply evicts the specified file like this:

-(BOOL) evictLocaleFile:(NSString *)name
{
     NSURL *deletionURL = [[NSURL alloc] initFileURLWithPath:[ubiquityContainerURL path]];

     deletionURL = [deletionURL URLByAppendingPathComponent:@"Documents" isDirectory:YES];
     deletionURL = [deletionURL URLByAppendingPathComponent:name isDirectory:NO];
     NSLog(@"EVICTION URL: %@", deletionURL.path);

     NSError* err = nil;

     BOOL didEvict = [[NSFileManager defaultManager] evictUbiquitousItemAtURL:deletionURL error:&err];

     if (err != nil)
     {
         NSLog(@"Eviction error: %@", err.description);
     }

     return didEvict;
}

The method for listing local files looks like this:

-(NSArray*) listAllLocalFiles
{
     NSString *localPath = [[ubiquityContainerURL path] stringByAppendingFormat:@"/Documents"];

     NSLog(@"PATH: %@", localPath);

     NSArray* files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:localPath error:nil];

     for (NSString* fileName in files)
     {
         NSLog(@"FILE %@", fileName);
     }

     return files;
}

Now the weird thing is that when I execute the program, it does state that it evicts the file successfully. But yet the file is still listed as existing under the locale files? Shouldn’t the file be completely removed and non-existing at this point? I’m not sure why the file is not being removed.

I even attempted to first save the file down, then turn off WIFI and run the code again to make sure it’s not because iCloud forces the file to be downloaded again, but this did nothing to solve the problem.

Anyone has an idea of what could be happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:49:35+00:00Added an answer on June 12, 2026 at 9:49 am

    So I figured out the problem.

    My code was actually evicting the file from my local device correctly. It was due to a misunderstanding of how the ubiquity container actually worked on my behalf. I was under the impression that every app had a local ubiquity container which showed a local state on the current device (so that would mean only files you have downloaded on the testing device), instead the ubiquity container URL used shows all files available to you, whether you’ve downloaded them on the current device or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an array which has BIG numbers and small numbers in it. I
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.