【问题标题】:Appcelerator - Post a Tweet from iPhone App - Stuck on Callback URLAppcelerator - 从 iPhone 应用发布推文 - 卡在回调 URL 上
【发布时间】:2012-09-30 12:11:47
【问题描述】:

我需要使用 Appcelerator Titanium 和 javascript 从我的 iphone/ipad 应用程序发送推文。我在 github 上找到了以下示例(代码也在下面发布):

https://gist.github.com/2eabc31db388144b3abc

我已经在我的 twitter 开发者帐户中创建了我的应用程序详细信息(密钥、秘密等),并使用示例中的代码我得到了 twitter 登录和授权弹出窗口,但是一旦你点击授权,我得到的只是一个显示回调的 web 视图url(我需要输入 twitter 应用程序设置)。所以应用程序卡在显示回调 url 的 web 视图上,但之后什么也不做。如果我关闭弹出窗口,它只会返回我的应用程序而不发送推文。

谁能帮忙?

app.js 中的代码:

var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var shareButton = Ti.UI.createButton({
    width: 90, bottom: 10, height: 30,
    title: 'Tweet!"'
});
win.add(shareButton);
win.open();

var social = require('social');
var twitter = social.create({
    site: 'Twitter',
    consumerKey: 'XXXXXXXXXXXXXXXX', 
    consumerSecret: 'XXXXXXXXXXXXXXXXXXXXX' 
});

shareButton.addEventListener('click', function() {
    twitter.share({
        message: 'Hello, world!',
        success: function() {
            alert('Tweeted!');
        },
        error: function(error) {
            alert('Oh no! ' + error);
        }
    });
});

【问题讨论】:

  • 这是来自 QA 论坛的同一个问题吗?不想在这两个地方都和你交谈?
  • 嗨亚伦,是的。谢谢你在那里的帮助。现在一切都整理好了:)

标签: iphone twitter titanium appcelerator callbackurl


【解决方案1】:

作为Aaron answered on the Q&A,在使用Social.js 时,不应使用回调URL。 code itself will watch the web view 满足它的需要。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-27
    • 1970-01-01
    • 1970-01-01
    • 2013-02-03
    • 2014-06-06
    • 2011-09-03
    相关资源
    最近更新 更多