Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

+[NSData dataFromBase64String:]: unrecognized selector sent to class #3

Closed
emnloc opened this issue Jan 19, 2016 · 6 comments
Closed

Comments

@emnloc
Copy link

emnloc commented Jan 19, 2016

This message appears and the app crashes.

I'm using cordova 5

My code is:

cordova.base64ToGallery(
        canvas.toDataURL().replace('data:image/png;base64,', ''),
        'img_',
        function(msg){
          console.log(msg);
        },
        function(err){
          console.log(err);
        }
      );

@StefanoMagrassi
Copy link
Contributor

Hello emnloc,

which version of Xcode and iOS are you using?

And you don't need to call the replace() method on dataUrl stringe because the plugin already do that.

@emnloc
Copy link
Author

emnloc commented Jan 19, 2016

@StefanoMagrassi I'm using Xcode 7.2 and ios 9.2

@StefanoMagrassi
Copy link
Contributor

@emnloc it could be a problem with NSData+Base64.h class that, according to cordova-ios documentation, seems to have been removed from version 4.0 of the platform.

I wrote this plugin for a specific project and maybe I was lucky (Xcode warns me about deprecated methods, but the app runs well anyway).

I can't fix it now, but I will probably start working on it tomorrow.

If you can't wait, you can try to edit the Base64ToGallery.m script and maybe send a PR.

@StefanoMagrassi
Copy link
Contributor

@emnloc I probably fixed the issue.

Please, checkout the "issue#3" branch and make some test.

I've tried with my cordova application on a Macmini with Xcode 7.2: no warnings or errors and the image was saved on the device. But I need to be more confident before merging it in "master" branch and publishing it on npm.

Tell me if have some troubles with the tests.

@emnloc
Copy link
Author

emnloc commented Jan 22, 2016

@StefanoMagrassi it works fine, I've tested in on my iPad mini and the simulator.

Great job!! 👏 👏

@StefanoMagrassi
Copy link
Contributor

@emnloc ok, perfect.

I cannot merge the branch now, but I wil do it during the day.
When I'll close the issue you will find on npm (and here obviously) the new plugin version

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants