Canvas2ImagePlugin icon indicating copy to clipboard operation
Canvas2ImagePlugin copied to clipboard

Plugin fails on Cordova iOS 4.0

Open racekarl opened this issue 9 years ago • 9 comments

Cordova iOS 4 removed several deprecated methods which are used by this plugin, so the plugin crashes when used in an app built with Cordova iOS 4.

For example, this line:

NSData* imageData = [NSData dataFromBase64String:[command.arguments objectAtIndex:0]];

Causes a crash because dataFromBase64String no longer exists in Cordova iOS 4.0:

https://github.com/apache/cordova-ios/blob/master/guides/API%20changes%20in%204.0.md

racekarl avatar Jan 26 '16 14:01 racekarl

there is alot wrong with this plugin and I don't think @devgeeks is actively supporting it. i am interested in either starting a new one or taking this over.

ghost avatar Jan 26 '16 15:01 ghost

Yes, @devgeeks mentioned on another issue that this plugin was essentially abandoned, but I figured I would report the issue in case someone else wants to take it over.

I'm slogging through a fix for this issue because I need it ASAP to solve a production issue I have, but I am not an Objective C programmer, so I am fumbling in the dark...

I will post what I find here, and do let me know if you fork this, replace it, or take it over - I can at least help with testing.

racekarl avatar Jan 26 '16 15:01 racekarl

@createstandard - I would love someone to take it over :(

I created the plugin originally as a throwaway as an answer to a stack overflow question and it has gotten a bit out of control ;)

devgeeks avatar Jan 26 '16 16:01 devgeeks

OK I'll see if I can get some help, I'm not an OBJ C developer (hence why I use Cordova). I have an app that basically revolves around this plugin and I need to update it but I can't until we fix this. Perhaps I can pay someone to fix it for us. Let me do some emailing.

ghost avatar Jan 26 '16 16:01 ghost

OK, I got this working on Cordova iOS 4. I have no idea if what I have done is terrible or not, but it does what I need it to do. This functionality is ancillary to my app, so it's not as critical to me as it may be to you @Createstandard.

I have attached my copy of Canvas2ImagePlugin.m with my changes (as a text file since that's what github supports)

Canvas2ImagePlugin.txt

racekarl avatar Jan 26 '16 16:01 racekarl

Ok awesome thanks, I'll dig into this in a few days and keep you guys posted.

ghost avatar Jan 26 '16 16:01 ghost

To anyone who might be interested, we just release another plugin to npm, called cordova-plugin-save-image. This plugin is not using bas64 encoded images but file paths to images available on the device already and copies them to the camera roll / Gallery. We have taken some code element from the Canvas2Image plugin, thx a lot for this. In addition we are considering to maybe take over this one (merge with save-image plugin) going forward.

SebastianSchirmer avatar Apr 21 '16 13:04 SebastianSchirmer

As I said before... I would looooove someone to take this over. It obviously fills a need for some people, but it's not something I am keen to maintain.

devgeeks avatar Apr 21 '16 23:04 devgeeks

Ok, I'll discuss within the team

SebastianSchirmer avatar Apr 22 '16 06:04 SebastianSchirmer