下载文件时,我没有收到 on.progress 回调,因此无法显示进度条。适合文件上传。
我做错了什么?
谢谢, 皮特
BoxFile *boxFile = (BoxFile *)boxObject;
[boxFile previewWithCallbacks:^(id<BoxOperationCallbacks> on)
{
on.progress(^(NSNumber *ratio)
{
// update progress bar
});
on.after(^(BoxCallbackResponse response)
{
if (response == BoxCallbackResponseSuccessful)
{
最佳答案
我们有同样的问题,但我们设法找到了答案,尽管我们还没有尝试实现它。
"Currently, the expected method to get progress on file downloads is to register your object as an observer of the download queue ([Box registerObserverForDownloadQueue:self];) and then to extend the BoxObserver protocol and implement any of these callback methods that you are interested in:
- (void)downloadDidBeginForItem:(BoxID *)itemID;
- (void)downloadDidProgressForItem:(BoxID *)itemID bytesDownloaded:(NSUInteger)bytes;
- (void)downloadDidCompleteForItem:(BoxID *)itemID withResponse:(BoxCallbackResponse)response;
- (void)downloadDidCompleteForAllItems;
Please remember to remove your object from the observers before you expect your object to be deallocated because observers are currently retained."
关于box-api - Box iOS SDK : No on. 用于预览的进度回调 With Callbacks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13518337/