ActionSheetIOS - Pass URL, not file contents to UIActivityViewController for file URLs.

Summary:
Currently, when sharing local files, the file contents are being sent as NSData causing the file to never be attached when sharing via Email or via Airdrop, being renamed to something obscure such as (null)-257D026032E9-1.data
Simply passing the Local File URL to UIActivityViewController instead of the file contents resolves this issue.
More info on this issue: https://github.com/facebook/react-native/issues/8442
Closes https://github.com/facebook/react-native/pull/9693

Differential Revision: D3821142

Pulled By: javache

fbshipit-source-id: a06128db88d24cf5565169f321365ace43ab89fe
This commit is contained in:
sheparddw 2016-09-06 04:32:36 -07:00 committed by Facebook Github Bot 3
parent 0d176b3337
commit 4f004fa3e5
1 changed files with 1 additions and 1 deletions

View File

@ -135,7 +135,7 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions:(NSDictionary *)options
}
NSURL *URL = [RCTConvert NSURL:options[@"url"]];
if (URL) {
if (URL.fileURL || [URL.scheme.lowercaseString isEqualToString:@"data"]) {
if ([URL.scheme.lowercaseString isEqualToString:@"data"]) {
NSError *error;
NSData *data = [NSData dataWithContentsOfURL:URL
options:(NSDataReadingOptions)0