You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2015/03/16 14:39:33 UTC

cordova-plugin-file git commit: CB-8675 Revert "CB-8351 ios: Use base64EncodedStringWithOptions instead of CordovaLib's class extension"

Repository: cordova-plugin-file
Updated Branches:
  refs/heads/master caadf608a -> d57238b5b


CB-8675 Revert "CB-8351 ios: Use base64EncodedStringWithOptions instead of CordovaLib's class extension"

This reverts commit f7bfa8925b53da037c7f537fbacaaf71d925a224.
Not quite ready to drop iOS 6 in the plugin.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/d57238b5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/d57238b5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/d57238b5

Branch: refs/heads/master
Commit: d57238b5b6ce3b18dedd6987995921f4c92e92d4
Parents: caadf60
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Mar 16 09:10:49 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Mar 16 09:29:05 2015 -0400

----------------------------------------------------------------------
 src/ios/CDVFile.m | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d57238b5/src/ios/CDVFile.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFile.m b/src/ios/CDVFile.m
index 75194e6..eec8978 100644
--- a/src/ios/CDVFile.m
+++ b/src/ios/CDVFile.m
@@ -878,8 +878,13 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile";
         [fs readFileAtURL:localURI start:start end:end callback:^(NSData* data, NSString* mimeType, CDVFileError errorCode) {
             CDVPluginResult* result = nil;
             if (data != nil) {
-                NSString* b64str = [data base64EncodedStringWithOptions:0];
-                NSString* output = [NSString stringWithFormat:@"data:%@;base64,%@", mimeType, b64str];
+                SEL selector = NSSelectorFromString(@"cdv_base64EncodedString");
+                if (![data respondsToSelector:selector]) {
+                    selector = NSSelectorFromString(@"base64EncodedString");
+                }
+                id (*func)(id, SEL) = (void *)[data methodForSelector:selector];
+                NSString* b64Str = func(data, selector);
+                NSString* output = [NSString stringWithFormat:@"data:%@;base64,%@", mimeType, b64Str];
                 result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:output];
             } else {
                 result = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageAsInt:errorCode];


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org