Skip to content

Commit

Permalink
Updating for cordova-ios 4
Browse files Browse the repository at this point in the history
  • Loading branch information
funkjedi committed Feb 4, 2016
1 parent aeeba79 commit 7cd3f03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ios/Canvas2ImagePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ @implementation Canvas2ImagePlugin
- (void)saveImageDataToLibrary:(CDVInvokedUrlCommand*)command
{
self.callbackId = command.callbackId;
NSData* imageData = [NSData dataFromBase64String:[command.arguments objectAtIndex:0]];
NSData* imageData = [[NSData alloc] initWithBase64EncodedString:[command.arguments objectAtIndex:0] options:0];

UIImage* image = [[[UIImage alloc] initWithData:imageData] autorelease];
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
Expand All @@ -37,14 +37,14 @@ - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error context
// Show error message...
NSLog(@"ERROR: %@",error);
CDVPluginResult* result = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString:error.description];
[self.webView stringByEvaluatingJavaScriptFromString:[result toErrorCallbackString: self.callbackId]];
[self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
}
else // No errors
{
// Show message image successfully saved
NSLog(@"IMAGE SAVED!");
CDVPluginResult* result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString:@"Image saved"];
[self.webView stringByEvaluatingJavaScriptFromString:[result toSuccessCallbackString: self.callbackId]];
[self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
}
}

Expand Down

1 comment on commit 7cd3f03

@inceptiveKshitij
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still didn't get image url in ios

Please sign in to comment.