Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Can't share to Instagram (except Reel) in iOS 16.3.1 #169

Open
stankikween opened this issue Apr 7, 2023 · 1 comment
Open

Can't share to Instagram (except Reel) in iOS 16.3.1 #169

stankikween opened this issue Apr 7, 2023 · 1 comment
Labels

Comments

@stankikween
Copy link

I am trying to share a screenshot and text on iOS. I understand the limitations of sharing both a screenshot and text on certain applications, and on Facebook and Messenger the screenshot shares fine without the text included.

However, when I try to share to Instagram, after tapping the Instagram app it gives me the option to share to a Reel, Post, Story, or Message. When I select Reel it seems to work, however when I select Story or Message I get a pop-up that says "Error, Something went wrong." When I select Post I get a pop-up that says "Error, We're sorry, but something went wrong. Please try again."

I tried removing the text portion of my share so that it was just attempting to share the image, and was still getting the errors on just Instagram. Every other application I have tried (Facebook, Messenger, Slack, Teams, Email, Snapchat, etc) shares successfully.

I am using what is essentially the sample code:

` private IEnumerator TakeScreenshotAndShare()
{
yield return new WaitForEndOfFrame();

    Texture2D ss = new Texture2D( Screen.width, Screen.height, TextureFormat.RGB24, false );
    ss.ReadPixels( new Rect( 0, 0, Screen.width, Screen.height ), 0, 0 );
    ss.Apply();

    string filePath = Path.Combine( Application.temporaryCachePath, "shared img.png" );
    File.WriteAllBytes( filePath, ss.EncodeToPNG() );

    // To avoid memory leaks
    Destroy( ss );

    new NativeShare().AddFile( filePath )
	    .SetSubject( "Cafe Sudoku" ).SetText( shareMessage )
	    .SetCallback( ( result, shareTarget ) => Debug.Log( "Share result: " + result + ", selected app: " + shareTarget ) )
	    .Share();

}`
  • Unity version: 2021.3.11f1
  • Platform: iOS
  • Device: iPhone X with iOS 16.3.1
  • Downloaded plugin with Unity Asset Manager

Additional info

Here is a log I got when attempting to share to my Instagram Story:

`2023-04-07 14:37:12.077694-0700 CafeSudoku[30089:2121970] [core] SLRemoteComposeViewController: (this may be harmless) viewServiceDidTerminateWithError: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method}
2023-04-07 14:37:12.572509-0700 CafeSudoku[30089:2121970] Shared to com.burbn.instagram.shareextension with result: 0
Share result: NotShared, selected app: com.burbn.instagram.shareextension
<>c:b__5_0(ShareResult, String)

2023-04-07 14:37:12.816105-0700 CafeSudoku[30089:2122385] [ShareSheet] connection invalidated`

@stankikween stankikween added the bug label Apr 7, 2023
@yasirkula
Copy link
Owner

Can you try applying this change to the code: #22 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants