If you have a large object to download or it is time-consuming to download the entire object at a time, you can use streaming download. Streaming download enables you to download part of the object content each time until you download the entire object.

The OSS iOS SDK provides no streaming download APIs. Instead, it provides the multipart callback function similar to didRecieveData in the NSURLSession library. Note: The download result does not contain the actual data if the multipart callback is configured.

Use the following code for streaming download:

OSSGetObjectRequest * request = [OSSGetObjectRequest new];
// Configure required fields.
request.bucketName = @"<bucketName>";
request.objectKey = @"<objectKey>";
// Configure the multipart callback function.
request.onRecieveData = ^(NSData * data) {
    NSLog(@"Recieve data, length: %ld", [data length]);
OSSTask * getTask = [client getObject:request];
[getTask continueWithBlock:^id(OSSTask *task) {
    if (! task.error) {
        NSLog(@"download object success!") ;
    } else {
        NSLog(@"download object failed, error: %@" ,task.error);
    return nil;
// [getTask waitUntilFinished];
// [request cancel];