Skip to content

Instagram

levching edited this page Apr 15, 2020 · 3 revisions

Before you begin

  • The Facebook SDK for Unity only supports iOS version 7.0 and above.
  • Make sure That Social API is enabled under the plugin editor settings.
  • Facebook
  • Make sure, that Texture2D you trying to share is Readable.

Code Snippets

The code snippet below will demonstrate Instagram posting example:

using SA.iOS.Social;
...
ISN_Instagram.Post(screenshot);

We can also find out posting result

using SA.iOS.Social;
...
ISN_Instagram.Post(screenshot, HandleOnInstagramPostResult);

void HandleOnInstagramPostResult(SA_Result result) {
    if (result.IsSucceeded) {
        Debug.Log("Post Success!");
    } else {
        Debug.Log("Post Failed! Error code: " + result.Error.Code);
    }
}

In case if an error has occurred, the result.Error.Code will contain one of the following error codes:

  • 1 - The wasn't installed on a device.
  • 2 - The user cancelled posting.
  • 3 - The system version error.
  • 4 - The internal exception.

Note: With the latest Instagram app the image caption will be ignored. Instagram provides documentation on iOS hooks. This documentation does not make any mention of a caption parameter. It means that this doesn't seem to be an officially supported use case. But caption parameter was working correctly with the previous Instagram app version. Now they are probably sticking with the same policy as Facebook. "Users should share only own thoughts" and any text provided by developer will be ignored. However, we can always put some text on the image we are sharing :) This behavior may change in future, so keep your sharing text.

About

Foundation

AV Foundation

App Tracking Transparency

Game Kit

Store Kit

UI Kit

Social

Replay Kit

Contacts

AVKit

Photos

App Delegate

User Notifications

MediaPlayer

Core Location

AdSupport

EventKit

CloudKit

Authentication Services

XCode

Knowledge Base

Clone this wiki locally