Unity iOS, Android composer callback


#1

Hello.

when sharing, how can I receive the callback? And if you can not, will it be implemented?
In android works me fine, but in iOS I login but when I send a part, but it gives an error (Tweer failed to send, tweet not sent)

thanks!


#2

Currently there is no callback for the composer.

Can you paste the code you are using to call the Composer in CSharp?

Also paste the full stack trace from Xcode of the error.


#3

hi,
My code is:

st

rong text

type or paste code here

void Start () { 		
  instance = this; 		
  urlLocal = Application.persistentDataPath; 		
  nameURLLocal = "/Screenshot.png"; 	
}  	
public void LoginTW () { 		
  Twitter.Init (); 		
  Twitter.LogIn (AuthCallback, (ApiError error) => { 			
  UnityEngine.Debug.Log (error.message); 		
  } ); 	
}  	
public void LoginCompleteWithCompose (int num) { 		
  METODO = num; 		
  Twitter.Init (); 		
  if (Twitter.Session != null) { 			
    TwitterSession session = Twitter.Session; 			
    string title = DataBaseLanguage.shareTitle [METODO]; 			
    string text = DataBaseLanguage.shareText [METODO]; 			
    string urlImagen = "https://pbs.twimg.com/media/DE7k80IXYAA_pgn.jpg"; 			
    listaDowloaderImagen = 1; 			
    downloadImage (urlImagen, urlLocal); 			
    StartCoroutine (esperandoDescargarImagen (title, text));  		
  } else { 			
    Twitter.LogIn (AuthCallback, (ApiError error) => { 				
      UnityEngine.Debug.Log (error.message); 			
    } ); 		
  Preformatted text} 	
}  	


IEnumerator esperandoDescargarImagen (string title, string text) { 
  while (listaDowloaderImagen != 0) { 
    yield return null; 
  }
  Twitter.Compose (Twitter.Session, "file://" + urlLocal + nameURLLocal, title, new string[]{ text, URL });
}   	
public void downloadImage (string url, string pathToSaveImage) { 		
  WWW www = new WWW (url); 		
  StartCoroutine (_downloadImage (www, pathToSaveImage)); 	
}  	
private IEnumerator _downloadImage (WWW www, string savePath) { 		
  yield return www; 		
  //Check if we failed to send 		
  if (string.IsNullOrEmpty (www.error)) { 			
    //Save Image
    saveImage (savePath, www.bytes); 		
  }else{ 			
    listaDowloaderImagen--; 		
  } 	
}  	
void saveImage (string path, byte [] imageBytes) { 		
  //Create Directory if it does not exist 		
  if (!Directory.Exists (Path.GetDirectoryName (path))) { 			
    Directory.CreateDirectory (Path.GetDirectoryName (path)); 		
  }  		
  try { 	
    File.WriteAllBytes (path + nombreURLLocal, imageBytes); 			
    listaDowloaderImagen--; 		
  }catch (Exception e) { 			
    listaDowloaderImagen--; 		
  } 	
}

The Xcode error is:
Did encounter error sending Tweet: Error Domain=TWTRNetworkingErrorDomain Code=-1011 “Request failed: unauthorized (401)” UserInfo={NSLocalizedFailureReason=, NSLocalizedDescription=Request failed: unauthorized (401), NSErrorFailingURLKey=https://api.twitter.com/1.1/statuses/update.json, TWTRNetworkingStatusCode=401}

Will the callback ever be? And you know when roughly?

thanks!


#4

It looks like you might have similar issues to Unity Fabric Compose Tweets in Android
Have you tried the items mentioned there?


#5

I’ve tried it, but it still does not work.


#6

Have you tried creating a new test app (apps.twitter.com) to see if that works? (set callback url)


#7

Hi, I’ve tried it and it still does not work


#8

Hi,
I need help with this.
Bye


#9

Hello,
Callbacks have now been added to the Tweet Composer, please upgrade to v.3.2.0
https://dev.twitter.com/twitterkit/unity/installation

regards,
Adam