Here is how to share a picture / image with Instagram with Corona SDK without Enterprise

I did all of that, but it doesn’t work.

Instagram opens allright but I doubt it can fetch the image from my apps DocumentsDirectory.

As far as I know it will only accept images from the photo library of the device.

Maybe you are saving the image you are sharing to the photo library aswell?

Arg, you’re right! It select it because it was in the gallery and the path I provided is just ignored :(. Will edit my post.

Yeah I know that argh feeling :slight_smile:

To succeed doing this I think you would need to save the image to the camera roll and somehow pass the path for that image, but I am not sure this is even possible.

I think instagram/apple decided that the only way to share to instagram is through the native UIDocumentsInteractionController.

Corona doesn’t have that implementet but you should vote it up in the feature requests.

See this thread: http://forums.coronalabs.com/topic/53371-supporting-ios-modal-share-action-sheet-airdrop-print-add-to-home-screen-add-bookmark-add-to-reading-list-etc/

I found a way, cheating a little…

  1. I save the picture to the camera roll.

  2. I use the libray hook with 999999999 as the asset path and Instagram select the LAST picture (another value make the previous picture to be selected)

(I wait for a delay before opening instagram after saving the picture)

Here is the hook:

local url = "instagram://library?AssetPath=999999999" if system.openURL( url ) then -- OK ! else native.showAlert( "Instagram not available", "Instagram is not available on this device. You should install it first.", {"OK"} ) end

Cool it is working.

To add a message to the share do this:

 local escape = require("socket.url").escape local caption = escape("Som caption for my image") local url = "instagram://library?AssetPath=999999999&InstagramCaption="..caption

Guess you just striked out some votes in the feature request page :slight_smile:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/3950970-post-images-to-instagram

FYI there’s an ongoing discussion of supporting the iOS share action sheet here:

http://forums.coronalabs.com/topic/53371-supporting-ios-modal-share-action-sheet-airdrop-print-add-to-home-screen-add-bookmark-add-to-reading-list-etc/

It is the most-requested feature on the feedback site (and requires only approximately 10 lines of Objective C) but, unfortunately, Corona staff have yet to commit to adding it. :frowning:  

@ojnab: amazing, thanks!

@corona273: ok, will follow :slight_smile: should be great.

Good news! Brent from Corona just posted an update in the other thread saying the iOS share action sheet will be supported within the next few days:

http://forums.coronalabs.com/topic/53371-supporting-ios-modal-share-action-sheet-airdrop-print-add-to-home-screen-add-bookmark-add-to-reading-list-etc/#entry282502

@david-pro You mentioned android is providing a universal share feature including instagram. Could you explain what this is how to use it? I’d like to get instagram working on android as well. Thanks!

You just have to use the social plugin: native.showPopup( “social”…

You just have to use the social plugin: native.showPopup( “social”…

Quite right, but note Corona’s native.showPopup is broken on Android and does not share with Facebook (maybe Instagram sharing works on Android, haven’t confirmed it). Rob said last week that it may be fixed:

http://forums.coronalabs.com/topic/52755-can-corona-enable-limited-facebook-sharing-on-android-via-nativeshowpopup/