开发者

DropBox API - how to find out if dropBox is done with its business

Just a very short question about DropBox - is there any way to find out when both uploads and downloads are done?

There are the functions

-(void)restClient:(DBRestClient *)client uploadedFile:(NSString *)srcPath 
-(void)restClient:(DBRestClient *)client loadedFile:(NSString *)destPath 
-(void)restClient:(DBRestClient *)client loadedFileFailedWithError:(NSError *)error
-(void)restClient:(DBRestClient *)client uploadFileFailedWithError:(NSError *)error

But is there some function which tells you when all of these are ended? I need to do a sync, i.e. possibly upload and download files, and then stop the animation telling the user that DB is still doing something. E.g. if the loadedFile is called first and ends the animation, while an upload is still going on, this is obviously no good.

So is there something like: dropBox stopped working and we can now tell the user what has been uploaded/downloaded/if there were any errors?

Thanks in advance and sorry if I have overlooked the obvious but I find the dropBoxAPI not ve开发者_运维问答ry well documented.


You have to do that manually. There's no embedded command to do this. Simply create an int and set its value to the number of files you have to transfer. When each transfer is done or if it fails, decrease the value of that int. If it reaches 0, end the animation.


It is simple : Just do a NSMutableArray in which you store all your dbRestClients Remove the dbRestClient when you receive a finish or a fail message. That way, you can immediately know how many clients are running, and if you catch the "progress" message, you can calculate the global progression. TIP : When I allocate a dbRestClient, I put some information in the AccessibilityLabel property, so that I know which of them responds.

Good luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜