watzak / react-native-instagram-share

react-native interface to share images and videos within instagram
31 stars 4 forks source link

No Media on Instagram #2

Open brainbrain34 opened 8 years ago

brainbrain34 commented 8 years ago

Hi im trying to pass a video to share on instagram i have the correct link i get it from my camera roll:

i have a function to call on press button to go to instagram:

Then when i press with console log the params are ok and goes correctly to instagram, but dont select the video and instagram show me a message: "No Media Photos and videos in your camera roll will appear here" if select manually i can share, how i can fix it to get the video i pass to share like on your demo ¿? i tried with images and happens the same.

image

philsippl commented 8 years ago

+1 exactly the same problem for me!

Toomaie commented 8 years ago

Same here. Did you guys found any solution?

The API used in this library seems deprecated as the official one no longer has the instagram://library endpoint https://www.instagram.com/developer/mobile-sharing/iphone-hooks/

philsippl commented 8 years ago

Yeah I made it work for me by changing to following undocumented url scheme: instagram://library?LocalIdentifier=PHASSET_ID (http://stackoverflow.com/questions/34226433/instagram-hooks-pre-select-media-issue) If you only have a AssetPath like library://asset/asset.MOV?id=2A2CE6C9-C178-4395-977B-E6F159BF6D5E&ext=MOV, the PHASSET_ID is simply the id in the url followed by a /L0/001. So in this example the correct url for instagram would be: instagram://library?LocalIdentifier=2A2CE6C9-C178-4395-977B-E6F159BF6D5E/L0/001. Both things are completely undocumented and not officially supported, so this might break in the future, but I really needed a quick workaround.

rgovindji commented 8 years ago

@philsippl Does this still work for you, I tried it but can't get the media to open in instagram.

philsippl commented 8 years ago

@rgovindji I've tested it and right now it still seems to work. You have to make sure that the image is in the gallery, so the instagram app has permissions for the file.

rgovindji commented 8 years ago

@philsippl I can see the image in the library but I have to manually select it within Instagram.

Do you see something wrong with my AssetPath?

Original: assets-library://asset/asset.JPG?id=2519299C-936A-45B8-9F56-F3D0C7ED0661&ext=JPG
AssetPath: instagram://library?LocalIdentifier=2519299C-936A-45B8-9F56-F3D0C7ED0661/L0/001
philsippl commented 8 years ago

@rgovindji The url seems to be fine. Have you changed the plugin accordingly? This is how I changed the plugin to make it work:

NSURL *instagramURL       = [NSURL URLWithString:[NSString stringWithFormat:@"instagram://library?LocalIdentifier=%@&InstagramCaption=%@", assetsLibraryURL, escapedCaption]];

The assetsLibraryURL is now the id. You can leave out the caption, this field is not working anymore.

rgovindji commented 8 years ago

@philsippl I did not, I'll try that now!

krzkaczor commented 8 years ago

I think that you need only that long ID. I extracted it in following way (and it works :D) :

NSString* localId = [assetURL.absoluteString substringWithRange:NSMakeRange(36, 36)]; //we need to get id from whole URL
NSURL *instagramURL       = [NSURL URLWithString:[NSString stringWithFormat:@"instagram://library?LocalIdentifier=%@", localId]];
Den-Ree commented 7 years ago

I have problem with instagram://library?LocalIdentifier=AssetId after last update with multiple photos.

MattTimmons commented 6 years ago

Is anyone percent encoding the localIdentifier?

Den-Ree commented 6 years ago

@MattTimmons does it work for you?

MattTimmons commented 6 years ago

I am not percent encoding the localIdentifier. But, I tried to and still have an issue. To be clear, I am able to use this on an image just fine. But when using a video, instagram sees it on the initial "editor" screen. But then after your click "feed" it fails to see it with this image.

img_0975

MattTimmons commented 6 years ago

and update to my post.. I was using instagram://library?OpenInEditor=1&LocalIdentifier= and not instagram://library?LocalIdentifier= I found the "openIn" on a stackoverflow post I believe. Just test, and as of now instagram://library?LocalIdentifier= is working for me with both images and video.