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

  • Home
  • SEARCH
  • 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 8625837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:52:30+00:00 2026-06-12T07:52:30+00:00

I am downloading a file revision status from Dropbox and basically I compare downloaded

  • 0

I am downloading a file revision status from Dropbox and basically I compare downloaded revison number in Dropbox with revision number in my local plist.

After comparing them I want to change local revision number with Dropbox’s revision number. But it is not working I am about to loss my mind.

I put some flags and NSlogs it seems it replace the value but after I call same function or launch the app again I see that value is not replaced. It gives the same output over and over again

    NSString* revisionLocal = [dicInner objectForKey:@"revision"];
    NSString* statusLocal = [dicInner objectForKey:@"status"];

    NSLog(@"revision  value before %@",revisionLocal);
    NSLog(@"status value before %@",statusLocal);

   //If revision has changed on dropbox, flag it as outdated on the local revision
                        if(![revisionLocal isEqualToString: dropBoxRevision] ){
                            [dicInner setValue:@"outdated" forKey:@"status"];
                            //But the revision is the latest
                            [dicInner setValue:dropBoxRevision forKey:@"revision"];
                            //[dicInner setValue:@"outdated" forKey:@"revision"];

                            NSLog(@"revision value %@",[dicInner objectForKey:@"revision"]);
                            NSLog(@"status value %@",[dicInner objectForKey:@"status"]);

so this give me the output of:

revision  value before 4309efbbb7
status value before updated
revision value 4409efbbb7
status value outdated

And the full code is:

- (void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata {

    //get the local revision
    NSDictionary * localRevisionDic = [FileUtils readPlistIntoDictionary:@"revision.plist"];

    NSString *fileRevString = [NSString alloc];
    //get the revision from Dropbox
    //NSString * dropboxRevision;
    if (metadata.isDirectory) { 
        NSLog(@"Folder '%@' contains:", metadata.path);
        for (DBMetadata *file in metadata.contents) {

            NSLog(@"\t%@", file.filename);
            //NSLog(@"\t%@", file.lastModifiedDate);
            NSLog(@"\t%@", file.rev ); 

            //Assign dropbox revision for this file
            //dropboxRevision = file.rev;
            //if no local revision.plist, entry will be added. Hence init here
            if (localRevisionDic==nil){
                localRevisionDic = [[NSMutableDictionary alloc]init];

            }
            //Otherwise go through each from dropbox and campare with local

            //From Dropbox
            NSString * dropBoxFileName = file.filename;
            NSString * dropBoxRevision = file.rev;

            fileRevString = file.rev;

            //if no local revision.plist entry is added for all other files
            //with status need_downloaded, and no revision
            if ([localRevisionDic count]==0){

                //Creating revision dictionary entry for agenda.plist
                NSDictionary * localRevisionDicDic = [[NSMutableDictionary alloc]init];
                //when agenda.plist revision entry is added update the revision while leaving status as "new" before downloading
                //will be updated accordingly if download fails
                [localRevisionDicDic setValue:@"new" forKey:@"status"];
                //Status is new but the revision is the latest
                [localRevisionDicDic setValue:dropBoxRevision forKey:@"revision"];

                [localRevisionDic setValue:localRevisionDicDic forKey:dropBoxFileName];

            }else{//If there is local revision.plist compare and update accordingly
                NSDictionary * dicInner = [localRevisionDic objectForKey:dropBoxFileName];
                //File name Found locally
                if (dicInner!=nil){
                    NSString* revisionLocal = [dicInner objectForKey:@"revision"];
                    NSString* statusLocal = [dicInner objectForKey:@"status"];

                    NSLog(@"revision  value before %@",revisionLocal);
                    NSLog(@"status value before %@",statusLocal);

                    //If revision has changed on dropbox, flag it as outdated on the local revision
                    if(![revisionLocal isEqualToString: dropBoxRevision] ){
                        [dicInner setValue:@"outdated" forKey:@"status"];
                        //But the revision is the latest
                        [dicInner setValue:dropBoxRevision forKey:@"revision"];
                        //[dicInner setValue:@"outdated" forKey:@"revision"];

                        NSLog(@"revision value %@",[dicInner objectForKey:@"revision"]);
                        NSLog(@"status value %@",[dicInner objectForKey:@"status"]);
                    }
                    }else{//File name not found locally newly added on dropbox

                        NSDictionary * localRevisionDicDic = [[NSMutableDictionary alloc]init];
                        //when agenda.plist revision entry is added update the revision while leaving status as "new" before downloading
                        //will be updated accordingly if download fails
                        [localRevisionDicDic setValue:@"new" forKey:@"status"];
                        //But the revision is the latest
                        [localRevisionDicDic setValue:dropBoxRevision forKey:@"revision"];

                        [localRevisionDic setValue:localRevisionDicDic forKey:dropBoxFileName];
                }
            }
        }
    }
    //At this point agendaRevisionDicTemp contains all the files in dropbox entered/updated.
    [[self agenda] setRevision:localRevisionDic];

    //*****The following block is needed to determine is new agenda is needed or not.
    BOOL newAgendaNeeded = false;

    NSMutableDictionary * agendaRevisionDicLocal = [localRevisionDic objectForKey:@"agenda.plist"];

    //NSString * localRevision = [agendaRevisionDicLocal objectForKey:@"revision"]; //what is this value?

    NSString * localStatus = [agendaRevisionDicLocal objectForKey:@"status"];
    NSLog(@"Local Status= %@",agendaRevisionDicLocal);


    if ([localStatus isEqualToString:@"new"] ||[localStatus isEqualToString:@"outdated"]){
        newAgendaNeeded = true;
        //when agenda.plist is added update the revision while leaving status as "new" before downloading
        //will be updated accordingly if download fails
        NSDictionary * agendaDic = [[[self agenda]revision] objectForKey:@"agenda.plist"];
        [agendaDic setValue:@"updated" forKey:@"status"];
        NSLog(@"agendaDic where update %@",agendaDic);

    }
    //*****The above block is needed to determine is new agenda is needed or not.

    //If new agenda is needed download
    if (newAgendaNeeded){
        //Download agenda.plist
        NSString *documentsDirectory = FileUtils.getDocumentsDirectory;
        [[self restClient] loadFile:@"/agenda.plist" intoPath: [ NSString stringWithFormat:@"%@/%@",documentsDirectory,@"agenda.plist"] ];

    } else{//Else display the scene

        [self populateSceneFromAgenda];

    }

    [restOfView reloadData];
    // Add at start of requestFinished AND requestFailed
    [MBProgressHUD hideHUDForView:self.view animated:YES];
}

Any Idea How Can I replace that value?

  • 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-12T07:52:31+00:00Added an answer on June 12, 2026 at 7:52 am

    I guess your dictionary changes correctly whats wrong with your code should be that you do not save your dictionary to the plist you edit

    In fact there is deffinetly something wrong with that method[[self agenda] setRevision:localRevisionDic];

    Try to add following code below from [[self agenda] setRevision:localRevisionDic];

    //write dictionary to plist 
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *path = [documentsDirectory stringByAppendingPathComponent:@"revision.plist"];
        // write plist to disk
        [localRevisionDic writeToFile:path atomically:YES];
    
        // read it back in with different dictionary variable
        NSMutableDictionary *savedStock = [NSMutableDictionary dictionaryWithContentsOfFile:path];
        if( savedStock==nil ){
            NSLog(@"failed to retrieve dictionary from disk");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am downloading a file from dropbox which is taking a few seconds. I
I am downloading a file from a website and I have the link. But
I am downloading a file from the server/database via aspx page. When using the
I am using apache commons-net for downloading a file from an FTP server. That
hi i am downloading file from server using ASIHTTPRequest in my iphone application but
I am using dropbox API and downloading file in application document folder. I am
I am using ASIHTTPRequest for downloading file from server but its giving error Failed
System.out.println(s.toString().substring(0,s.indexOf(.mp3))); i am downloading file from android application.. i need to name them as
I'm downloading a file, supposedly a .csv file, from an external URL with the
I am downloading a file from an ftp server and saving it to 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.