I'm a newbie with code blocks. I came across this method declaration in Imgur API.
+ (void)uploadImageWithFileURL:(NSURL *)fileURL success:(void (^)(IMGImage *image))success progress:(NSProgress * __autoreleasing *)progress failure:(void (^)(NSError * error))failure;
Whats the right way of using this sort of methods? It gives me a compiler error when I try to use it as a chained blocks.
This is how I tried
[IMGImageRequest uploadImageWithFileURL:[NSURL URLWithString:@"/temp.jpg"] success:^(IMGImage *image) {
} progress:(NSProgress *__autoreleasing *){
}failure:^(NSError *error) {
}];
Thanks in advance.
The ^
means pass a block of code with parameters as described, the double *
on the NSProgress object means you allocate an object (pointer), then pass a pointer to that pointer...
NSURL *fileURL = // create a URL
NSProgress *progress;
[SomeClass uploadImageWithFileURL:fileURL success:^(IMGImage *image) {
// success code goes here
} progress:&progress failure:^(NSError * error) {
// error code goes here
}];
SomeClass is the class that provides this (class) method.