###実現したいこと
Cordovaで「Canvas2Image」を使ってキャンバスを画像に変換して保存しているのですが、iOSのみPathが帰ってきません。
調べてみた結果、このプラグインではPathが帰ってこないというのはわかったのですが、どうにかしてURIを帰ってくる様にできないかなと思っています。
Objective
1UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
この部分で保存をしている様なので、保存が終わった時にパスを取得できないかなと思っています。
色々調べたのですが、Objective-Cの知識が全くないのでお力を貸していただけないでしょうか?
よろしくお願いいたします。
全文
Objective
1- (void)saveImageDataToLibrary:(CDVInvokedUrlCommand*)command 2{ 3 self.callbackId = command.callbackId; 4 NSData* imageData = [[NSData alloc] initWithBase64EncodedString:[command.arguments objectAtIndex:0] options:0]; 5 6 UIImage* image = [[[UIImage alloc] initWithData:imageData] autorelease]; 7 UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil); 8 9} 10 11- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo 12{ 13 // Was there an error? 14 if (error != NULL) 15 { 16 // Show error message... 17 NSLog(@"ERROR: %@",error); 18 CDVPluginResult* result = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString:error.description]; 19 [self.commandDelegate sendPluginResult:result callbackId:self.callbackId]; 20 } 21 else // No errors 22 { 23 // Show message image successfully saved 24 NSLog(@"IMAGE SAVED!"); 25 CDVPluginResult* result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString:@"Image saved"]; 26 [self.commandDelegate sendPluginResult:result callbackId:self.callbackId]; 27 } 28}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。