Created
January 27, 2019 19:19
-
-
Save spudtrooper/0fce3005b296a04203c5c98ac5ddb4d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 6c29a9b1835c820ab0abfd5e8c9c86d399d272b5 | |
Author: Jeff Palm <jeffpalm@gmail.com> | |
Date: Sun Jan 27 14:18:03 2019 -0500 | |
Add failure callback on decoding failure | |
diff --git a/ios/RNReactNativeSharingWinstagram.m b/ios/RNReactNativeSharingWinstagram.m | |
index 1607079..03814de 100644 | |
--- a/ios/RNReactNativeSharingWinstagram.m | |
+++ b/ios/RNReactNativeSharingWinstagram.m | |
@@ -41,6 +41,10 @@ - (NSDictionary *)constantsToExport { | |
UIImage *image = [UIImage imageWithData: [[NSData alloc]initWithBase64EncodedString:base64Image options:NSDataBase64DecodingIgnoreUnknownCharacters]]; | |
if (!image) { | |
+ NSString *errorMessage = @"Decoding error"; | |
+ NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedString(errorMessage, nil)}; | |
+ NSError *error = [NSError errorWithDomain:@"com.rnshare" code:1 userInfo:userInfo]; | |
+ failureCallback(error); | |
return; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment