DBTask
Objective-C
@interface DBTask : NSObject {
NSOperationQueue *_queue;
}
Swift
class DBTask : NSObject
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.
-
A unique string identifier for this task.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull taskIdentifier;
Swift
var taskIdentifier: String { get }
-
Tracks the number of times this task has been retried.
Declaration
Objective-C
@property (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 (nonatomic, copy, readonly) 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