mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-03-17 06:21:03 +08:00
CB-8351 ios: Stop using now-deprecated [NSData base64EncodedString]
This commit is contained in:
parent
2ead6335c9
commit
80b0048384
@ -36,6 +36,14 @@
|
|||||||
|
|
||||||
static NSSet* org_apache_cordova_validArrowDirections;
|
static NSSet* org_apache_cordova_validArrowDirections;
|
||||||
|
|
||||||
|
static NSString* toBase64(NSData* data) {
|
||||||
|
SEL s1 = NSSelectorFromString(@"cdv_base64EncodedString");
|
||||||
|
SEL s2 = NSSelectorFromString(@"base64EncodedString");
|
||||||
|
SEL realSel = [data respondsToSelector:s1] ? s1 : s2;
|
||||||
|
NSString* (*func)(id, SEL) = (void *)[data methodForSelector:realSel];
|
||||||
|
return func(data, realSel);
|
||||||
|
}
|
||||||
|
|
||||||
@implementation CDVPictureOptions
|
@implementation CDVPictureOptions
|
||||||
|
|
||||||
+ (instancetype) createFromTakePictureArguments:(CDVInvokedUrlCommand*)command
|
+ (instancetype) createFromTakePictureArguments:(CDVInvokedUrlCommand*)command
|
||||||
@ -398,7 +406,7 @@ static NSSet* org_apache_cordova_validArrowDirections;
|
|||||||
NSData* data = [self processImage:image info:info options:options];
|
NSData* data = [self processImage:image info:info options:options];
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[data base64EncodedString]];
|
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:toBase64(data)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -600,7 +608,7 @@ static NSSet* org_apache_cordova_validArrowDirections;
|
|||||||
break;
|
break;
|
||||||
case DestinationTypeDataUrl:
|
case DestinationTypeDataUrl:
|
||||||
{
|
{
|
||||||
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[self.data base64EncodedString]];
|
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:toBase64(self.data)];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DestinationTypeNativeUri:
|
case DestinationTypeNativeUri:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user