1
votes

I used DropBox sync api to get sync my app data and import images from Dropbox. Now I wrote an observer to FileSystem. It's working fine with my account but is not working with other accounts. It's not giving any errors. addObserver:self forPathAndChildren:[DBPath root] block:^ does not get called.

 if (![DBAccountManager sharedManager].linkedAccount.linked)
        {
            [[DBAccountManager sharedManager] linkFromController:self];
        }
        else
        {
            if(!dbFileSys)
            {
                dbFileSys = [DBFilesystem sharedFilesystem];
            }
            __weak id weakSelf = self;
            [dbFileSys addObserver:self forPathAndChildren:[DBPath root] block:^
             {
                 [weakSelf loadFiles]; //load files
             }];

        }

This observer called in my account. If i use other account not called.

1
Show a little more code than that… what does the full set-up for adding that observer look like? Also, is "[DBPath root]" valid at that point? - Michael Dautermann
Hi @MichaelDautermann thanks for reply. I added observer in question. Please help me - Mohanadevi

1 Answers

0
votes

The observer looks fine. I assume it's called if you make actual changes to the target Dropbox, right?

Based on your title, I assume you're expecting this to get called when you first start the app. I think that will happen the first time you link an account on a device, assuming that account has files visible to your app. (E.g. maybe you're using File type permissions and the account you link already has files of that type.) Otherwise, I wouldn't expect the observer to be called, since there were no relevant changes sync'd from the server.