2013-12-04 2 views
3

Я пытался использовать социальные функции для своего приложения, недавно работая над отправкой твитов, я создал приложение для твиттера и пытался использовать birdhouse.js. Я получаю «авторизовать приложение» всплывающее окно, когда я нажимаю его я получаю перенаправлены на другую страницу, которая отображает булавку «от твиттере», но не твиты не будут посланы :(titanium отправить твиты из моего приложения

Мой код ниже:

Ti.include('lib/birdhouse.js'); 

//create your twitter session and post a tweet 
function postToTwitter() { 
    var BH = new BirdHouse({ 
     consumer_key : "*****************", 
     consumer_secret : "*****************", 
    }); 

    if (!BH.authorized) { 
     //call the birdhouse authorize() method 
     BH.authorize(); 
    } else { 
     message = 'test test test'; 
     BH.tweet(message, function() { 
      alertDialog = Ti.UI.createAlertDialog({ 
       message : 'Tweet posted!' 
      }); 
      alertDialog.show(); 
     }); 
    } 
} 

var buttonTwitter = Titanium.UI.createButton({ 
    width : 280, 
    height : 35, 
    top : 375, 
    left : 20, 
    title : 'Send Via Twitter' 
}); 

buttonTwitter.addEventListener('click', function(e) { 
    postToTwitter(); 
}); 

win1 = Ti.UI.createWindow({ 
    height : '480', 
    width : '100%', 
}); 

win1.add(buttonTwitter); 
win1.open(); 

ответ

Смежные вопросы