OlapicUploaderHandler Class Reference
| Inherits from | OlapicHandler : NSObject |
| Declared in | OlapicUploaderHandler.h |
Instance Methods
getUploaderFromMedia:onSuccess:onFailure:
Get an uploader from a media object
- (void)getUploaderFromMedia:(OlapicMediaEntity *)media onSuccess:(void ( ^ ) ( OlapicUploaderEntity *uploader ))success onFailure:(void ( ^ ) ( NSError *error ))failureParameters
- media
The media object
- success
A callback block for when the uploader is successfully retrieved
- failure
A callback block for when the SDK can’t get the uploader
Availability
v1.0
Discussion
Example:
[[[OlapicSDK sharedOlapicSDK] uploaders] getUploaderFromMedia:mediaEntityObject
onSuccess:^(OlapicUploaderEntity *uploader){
label.text = [uploader get:@"name"];
}
onFailure:^(NSError *error){
NSLog(@"Error: %@",error.description);
}];
Declared In
OlapicUploaderHandler.hgetUploaderFromURL:onSuccess:onFailure:
Get an uploader from its API URL
- (void)getUploaderFromURL:(NSString *)URL onSuccess:(void ( ^ ) ( OlapicUploaderEntity *uploader ))success onFailure:(void ( ^ ) ( NSError *error ))failureParameters
- URL
The uploader API URL
- success
A callback block for when the uploader is successfully retrieved
- failure
A callback block for when the SDK can’t get the uploader
Availability
v1.0
Discussion
Example:
[[[OlapicSDK sharedOlapicSDK] uploaders] getUploaderFromURL:@"users/001"
onSuccess:^(OlapicUploaderEntity *uploader){
label.text = [uploader get:@"name"];
}
onFailure:^(NSError *error){
NSLog(@"Error: %@",error.description);
}];
Declared In
OlapicUploaderHandler.huploadMediaFromUploader:imageData:metadata:onSuccess:onFailure:
Upload a media object
- (void)uploadMediaFromUploader:(OlapicUploaderEntity *)uploader imageData:(NSData *)imageData metadata:(NSDictionary *)metadata onSuccess:(void ( ^ ) ( OlapicMediaEntity *media ))success onFailure:(void ( ^ ) ( NSError *error ))failureParameters
- uploader
The uploader entity that will ‘own’ the media
- imageData
The image to upload, on data format
- metadata
The media information
- NSString caption -required
- NSString latitude -optional
- NSString longitude -optional
- NSArray stream -stream
- success
A callback block for when the media is successfully uploaded
- failure
A callback block for when the media can’t be uploaded
Availability
v1.0
Discussion
Example:
NSMutableDictionary *metadata = [[NSMutableDictionary alloc] init];
// Required
[metadata setValue:@"A brief description for the photo" forKey:@"caption"];
// Optional
// - Location
[metadata setValue:@"latitude" forKey:@"latitude"];
[metadata setValue:@"longitude" forKey:@"longitude"];
// - Streams
NSArray *streams = [[NSArray alloc] initWithObjects:streamEntityObject1,streamEntityObject2,nil];
[metadata setValue:streams forKey:@"stream"];
NSString *imagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"sample" ofType:@"png"];
NSData *imageData = [NSData dataWithContentsOfFile:imagePath];
[[[OlapicSDK sharedOlapicSDK] uploaders] uploadMediaFromUploader:uploaderEntityObject
imageData:imageData
metadata:metadata
onSuccess:^(OlapicMediaEntity *media){
// Done! The image should appear on the MQ
}
onFailure:^(NSError *error){
NSLog(@"Error: %@",error.description);
}];
Declared In
OlapicUploaderHandler.huploadMediaFromUploader:imageData:metadata:onSuccess:onFailure:onProgress:
Upload a media object and track the upload progresss
- (void)uploadMediaFromUploader:(OlapicUploaderEntity *)uploader imageData:(NSData *)imageData metadata:(NSDictionary *)metadata onSuccess:(void ( ^ ) ( OlapicMediaEntity *media ))success onFailure:(void ( ^ ) ( NSError *error ))failure onProgress:(void ( ^ ) ( float progress ))progressParameters
- uploader
The uploader entity that will ‘own’ the media
- imageData
The image to upload, on data format
- metadata
The media information
- NSString caption -required
- NSString latitude -optional
- NSString longitude -optional
- NSArray stream -stream
- success
A callback block for when the media is successfully uploaded
- failure
A callback block for when the media can’t be uploaded
- progress
A callback block that can be used to track the upload progress
Availability
v1.0
Discussion
Example:
NSMutableDictionary *metadata = [[NSMutableDictionary alloc] init];
// Required
[metadata setValue:@"A brief description for the photo" forKey:@"caption"];
// Optional
// - Location
[metadata setValue:@"latitude" forKey:@"latitude"];
[metadata setValue:@"longitude" forKey:@"longitude"];
// - Streams
NSArray *streams = [[NSArray alloc] initWithObjects:streamEntityObject1,streamEntityObject2,nil];
[metadata setValue:streams forKey:@"stream"];
NSString *imagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"sample" ofType:@"png"];
NSData *imageData = [NSData dataWithContentsOfFile:imagePath];
[[[OlapicSDK sharedOlapicSDK] uploaders] uploadMediaFromUploader:uploaderEntityObject
imageData:imageData
metadata:metadata
onSuccess:^(OlapicMediaEntity *media){
// Done! The image should appear on the MQ
}
onFailure:^(NSError *error){
NSLog(@"Error: %@",error.description);
}
onProgress:^(float progress){
NSLog(@"Progress: %%@",(progress/100));
}];
Declared In
OlapicUploaderHandler.h