SBBUploadManager Class Reference

Inherits from SBBBridgeAPIManager : NSObject
Conforms to SBBComponent
Declared in SBBUploadManager.h


This class handles communication with the Bridge file upload API.

– uploadFileToBridge:completion:

This is a convenience method that determines the appropriate content-type based on the file extension and calls through to uploadFileToBridge:contentType:completion:.

- (void)uploadFileToBridge:(NSURL *)fileUrl completion:(SBBUploadManagerCompletionBlock)completion

Declared In


– uploadFileToBridge:contentType:completion:

Upload a file to the Bridge server on behalf of the authenticated user, via the NSURLSessionUploadTask so it can proceed even if the app is suspended or killed. Requesting the pre-signed URL for the upload from the Bridge API happens in a background download task so that the whole process can be initiated regardless of current network connectivity, and will proceed as and when possible.

- (void)uploadFileToBridge:(NSURL *)fileUrl contentType:(NSString *)contentType completion:(SBBUploadManagerCompletionBlock)completion



The file to upload.


The MIME type of the file (defaults to “application/octet-stream” if nil).


A completion block to be called when the upload finishes (or fails). Note that this will never be called if the app has to be relaunched to respond to the background session delegate events; blocks cannot be persisted across app launches. If you need to be sure to get the call upon completion (successful or otherwise), set an uploadDelegate.


The file is copied to a temporary file with a unique name in the temporary directory, and the copy is uploaded, so the original can be safely deleted any time after making this call (though you may want to wait and do it in the uploadManager:uploadOfFile:completedWithError: method, in case the upload fails so you can try again). The temporary copy is deleted upon successful or unsuccessful completion of the upload attempt.

Declared In