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 7002569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:56:41+00:00 2026-05-27T20:56:41+00:00

I’m having trouble synching a simple textfile, I get this error when trying to

  • 0

I’m having trouble synching a simple textfile, I get this error when trying to open it:

{NSFilePath=/private/var/mobile/Library/Mobile Documents/4C224W52W5~com~piso13~opusDomini/currentLogPath, NSUnderlyingError=0xde9b460 “The operation couldn‚Äôt be completed. Bad file descriptor”}

This is how I create it

-(BOOL)createLogFolderFile{        

    NSString *uuid = nil;

    CFUUIDRef uuidRef = CFUUIDCreate(nil);

    uuid = (NSString*)CFUUIDCreateString(nil, uuidRef);

    CFRelease(uuidRef);    



    NSError *error = nil;

    [uuid writeToFile:[self filePath] atomically:NO encoding:NSUTF8StringEncoding error:&error];

    if (error) {

        NSLog(@"Error trying to create log file %@", error);        

        return FALSE;

    }

    else{

        return TRUE;

    }

}

-(NSString*)filePath{

    NSFileManager *fileManager = [NSFileManager defaultManager];

    NSString *iCloudPath = [[fileManager URLForUbiquityContainerIdentifier:nil] path];

    return [iCloudPath stringByAppendingPathComponent:LOG_FOLDER_FILE_NAME];

}

This is how I read it:

-(NSString*)readLogFolderFromFile{

    NSError *error = nil;

    NSString *logFolder = [NSString stringWithContentsOfFile:[self filePath] encoding:NSUTF8StringEncoding error:&error];

    if (error) {

        NSLog(@"Error when trying to read log folder from file: %@" ,error);

        return nil;

    }

    else{

        return logFolder;

    }

}

I’m using NSMetadataQuery to search for the file,
The notification query finish gathering info results positive.

Help?

  • 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-05-27T20:56:42+00:00Added an answer on May 27, 2026 at 8:56 pm

    The file was not downloaded. It seems NSMetadataQuery notifies about the existence of the file in the cloud. To actually get the file, extra code is needed:

    Inside queryDidFinishGathering notification:

     NSMetadataItem *item = [query resultAtIndex:0];
            self.metadataItem = item;
            BOOL isDownloaded = [[item valueForAttribute:NSMetadataUbiquitousItemIsDownloadedKey]boolValue];
    
      if (!isDownloaded) {
            NSError *error = nil;
            [[NSFileManager defaultManager] startDownloadingUbiquitousItemAtURL: [item valueForAttribute:NSMetadataItemURLKey] error:&error];
            NSLog(@"Start downloading file");
            if (error) {
                NSLog(@"Error trying to download file: %@", error);
            }
            else{
                [self lookForLogFolderFile];
                return;
            }
    
        }
    

    The lookForLogFolderFile simply starts the query again.
    After several calls my item gets downloaded. You can also use a timer to between each call to start a NSMetadataQuery. In my case, is just a text file with one line.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.