Skip to content

Instantly share code, notes, and snippets.

@spudtrooper
Created January 27, 2019 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spudtrooper/0fce3005b296a04203c5c98ac5ddb4d8 to your computer and use it in GitHub Desktop.
Save spudtrooper/0fce3005b296a04203c5c98ac5ddb4d8 to your computer and use it in GitHub Desktop.
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