Post Video on Instagram
Try this code to post video on instagram it works for me hope it works for you also
first you have to save Video To Cameraroll then use this
NSString *strURL = [NSString stringWithFormat:@"instagram://library?AssetPath=%@&InstagramCaption=%@",yourfilepath,yourCaption];
NSString* webStringURL = [strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL* instagramURL = [NSURL URLWithString:webStringURL];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
{
[[UIApplication sharedApplication] openURL:instagramURL];
}
After the deprecation of ALAssetLibrary, Instagram has also disabled the AssetPath parameter. You can now use the localIndentifier property of PHAsset localIndentifier for this case.
NSURL *instagramURL = [NSURL URLWithString:[NSString stringWithFormat:@"instagram://library?LocalIdentifier=%@", placeholderForCreatedAsset.localIdentifier]];
[[UIApplication sharedApplication] openURL:instagramURL];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[[UIApplication sharedApplication] openURL:instagramURL];
}
PS: this works fine for me but it is still not documented anywhere.