Skip to content

Instantly share code, notes, and snippets.

@stelabouras
Last active October 4, 2024 20:15
Show Gist options
  • Select an option

  • Save stelabouras/1634b0c3ef080a0aa733 to your computer and use it in GitHub Desktop.

Select an option

Save stelabouras/1634b0c3ef080a0aa733 to your computer and use it in GitHub Desktop.
Loads a Camera Roll Asset to Instagram (works for both photos & videos)
- (void)loadCameraRollAssetToInstagram:(NSURL*)assetsLibraryURL andMessage:(NSString*)message
{
NSString *escapedString = [assetsLibraryURL.absoluteString urlencodedString];
NSString *escapedCaption = [message urlencodedString];
NSURL *instagramURL = [NSURL URLWithString:[NSString stringWithFormat:@"instagram://library?AssetPath=%@&InstagramCaption=%@", escapedString, escapedCaption]];
[[UIApplication sharedApplication] openURL:instagramURL];
}
@adamhaafiz

adamhaafiz commented Jul 27, 2017

Copy link
Copy Markdown

instagram://library?AssetPath=\(fileURLString) starting crashing for me all of a sudden, changing to instagram://library?OpenInEditor=1&LocalIdentifier=\(fileLocalIdString) works.

@dhomes

dhomes commented Jan 23, 2018

Copy link
Copy Markdown

is there a way from preventing it showing the POST TO FEED / STORY that started showing up recently? I'd like to go directly to my feed

@innoranveer

Copy link
Copy Markdown

I am facing the same issue the image which i want to share from app isn't landing on Instagram image editor, its forcing me to choose photo from library or camera

@roimulia

roimulia commented Feb 8, 2018

Copy link
Copy Markdown

Same issue as @innoravaneer

@Jaydip-iOS

Copy link
Copy Markdown

Thanks and i need same thing working for whatsapp Also so please can you share code for whatsApp ?

@AFathi

AFathi commented May 21, 2018

Copy link
Copy Markdown

@DavidAPears

Copy link
Copy Markdown
`instagram://library?OpenInEditor=1&LocalIdentifier=+${encodedURL}`; 

Worked for me :)

@rewaant

rewaant commented Nov 26, 2020

Copy link
Copy Markdown

Stopped working now. Any other way to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment