Inherits from OlapicEntity : NSObject
Declared in OlapicUploaderEntity.h

Overview

Represents Olapic Uploaders on the SDK

Instance Methods

uploadMediaFromData:metadata:onSuccess:onFailure:

Upload a media from an NSData

- (void)uploadMediaFromData:(NSData *)imageData metadata:(NSDictionary *)metadata onSuccess:(void ( ^ ) ( OlapicMediaEntity *media ))success onFailure:(void ( ^ ) ( NSError *error ))failure

Parameters

imageData

The image data to upload

metadata

The media object meta 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];

[uploaderEntityObject uploadMediaFromData:imageData
                      metadata:metadata
                      onSuccess:^(OlapicMediaEntity *media){
                          // Done! The image should appear on the MQ
                      }
                      onFailure:^(NSError *error){
                          NSLog(@"Error: %@",error.description);
                      }];

Declared In

OlapicUploaderEntity.h

uploadMediaFromData:metadata:onSuccess:onFailure:onProgress:

Upload a media from an NSData and track the upload progress

- (void)uploadMediaFromData:(NSData *)imageData metadata:(NSDictionary *)metadata onSuccess:(void ( ^ ) ( OlapicMediaEntity *media ))success onFailure:(void ( ^ ) ( NSError *error ))failure onProgress:(void ( ^ ) ( float progress ))progress

Parameters

imageData

The image data to upload

metadata

The media object meta 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];

[uploaderEntityObject uploadMediaFromData: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

OlapicUploaderEntity.h

uploadMediaFromImage:metadata:onSuccess:onFailure:

Upload a media from an UIImage

- (void)uploadMediaFromImage:(UIImage *)image metadata:(NSDictionary *)metadata onSuccess:(void ( ^ ) ( OlapicMediaEntity *media ))success onFailure:(void ( ^ ) ( NSError *error ))failure

Parameters

image

The image to upload

metadata

The media object meta 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"];

[uploaderEntityObject uploadMediaFromImage:[UIImage imageNamed:@"sample.png"]
                      metadata:metadata
                      onSuccess:^(OlapicMediaEntity *media){
                          // Done! The image should appear on the MQ
                      }
                      onFailure:^(NSError *error){
                          NSLog(@"Error: %@",error.description);
                      }];

Declared In

OlapicUploaderEntity.h

uploadMediaFromImage:metadata:onSuccess:onFailure:onProgress:

Upload a media from an UIImage and track the upload progress

- (void)uploadMediaFromImage:(UIImage *)image metadata:(NSDictionary *)metadata onSuccess:(void ( ^ ) ( OlapicMediaEntity *media ))success onFailure:(void ( ^ ) ( NSError *error ))failure onProgress:(void ( ^ ) ( float progress ))progress

Parameters

image

The image to upload

metadata

The media object meta 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"];

[uploaderEntityObject uploadMediaFromImage:[UIImage imageNamed:@"sample.png"]
                      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

OlapicUploaderEntity.h