DBTask

@interface DBTask : NSObject {
  DBRoute *_route;
  NSOperationQueue *_queue;
}

Base class for network task wrappers.

After a network request is made via DBTransportClient, a subclass of DBTask is returned, from which response and progress handlers can be installed, and the network response paused or cancelled.

Handlers are executed on the thread specified by the DBDelegate instance with which the DBTask instance is initialied (more specifically, the delegate queue that the DBDelegate uses to execute handler code). By default, this is the main thread, which makes updating UI elements in response handlers convenient.

While response handlers are not optional, they do not necessarily need to have been installed by the time the SDK has received its server response. If this is the case, completion data will be saved, and the handler will be executed with the completion data upon its installation. Downloaded content will be moved from a temporary location to the final destination when the response handler code is executed.

  • Information about the route to which the request was made.

    Declaration

    Objective-C

    DBRoute *_route
  • Tracks the number of times this task has been retried.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) int retryCount;

    Swift

    var retryCount: Int32 { get set }
  • Identifies a unique Dropbox account. Used for the multi Dropbox account case where client objects are each associated with a particular Dropbox account.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSString *_Nonnull tokenUid;

    Swift

    var tokenUid: String { get }
  • Full constructor.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithRoute:(nonnull DBRoute *)route
                                 tokenUid:(nonnull NSString *)tokenUid;

    Swift

    init(route: DBRoute, tokenUid: String)

    Parameters

    route

    Information about the route to which the request is being made.

    tokenUid

    Identifies a unique Dropbox account. Used for the multi Dropbox account case where client objects are each associated with a particular Dropbox account.

  • Cancels the current request.

    Declaration

    Objective-C

    - (void)cancel;

    Swift

    func cancel()
  • Suspends the current request.

    Declaration

    Objective-C

    - (void)suspend;

    Swift

    func suspend()
  • Resumes the current request.

    Declaration

    Objective-C

    - (void)resume;

    Swift

    func resume()
  • Starts the current request.

    Declaration

    Objective-C

    - (void)start;

    Swift

    func start()
  • Restarts the current request.

    Declaration

    Objective-C

    - (nonnull DBTask *)restart;

    Swift

    func restart() -> DBTask