Dropbox Sync API首先在iOS中同步 [英] Dropbox Sync api first Sync in iOS

查看:79
本文介绍了Dropbox Sync API首先在iOS中同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了DropBox同步api来同步我的应用程序数据并从Dropbox导入图像。现在,我为 FileSystem 写了一个观察者。我的帐户可以正常使用,但不能与其他帐户一起使用。没有出现任何错误。 addObserver:self forPathAndChildren:[DBPath根]块:^ 没有被调用。

  if(![DBAccountManager sharedManager] .linkedAccount.linked)
{
[[DBAccountManager sharedManager] linkFromController:self];
}
else
{
if(!dbFileSys)
{
dbFileSys = [DBFilesystem sharedFilesystem];
}
__weak id weakSelf = self;
[dbFileSys addObserver:self forPathAndChildren:[DBPath根目录]块:^
{
[weakSelf loadFiles]; //加载文件
}];

}

该观察员打来了我的帐户。

解决方案

观察者看起来还不错。我假设它是在您对目标Dropbox进行实际更改的情况下调用的,对吧?



根据您的标题,我假设您期望在初次启动时调用它该应用程序。我认为,这将在您首次在设备上关联帐户时发生,前提是该帐户具有对您的应用程序可见的文件。 (例如,也许您正在使用文件类型权限,并且您链接的帐户已经具有该类型的文件。)否则,由于没有从服务器同步的相关更改,我不希望调用观察者。 / p>

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.

解决方案

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.

这篇关于Dropbox Sync API首先在iOS中同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆