hi,
My code is:
strong 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!