Android和ios是否有任何有效的Twitter集成

时间:2014-05-25 00:39:45

标签: titanium-mobile

我已经尝试了很多代码来发布推文,但我没有找到任何有效的推特实现。

我尝试过 social.js - social_plus.js - alloy / social - birdhouse.js 等。

我的应用程序在以下行崩溃

correctTimestampFromSrc: function(parameterName) {
parameterName = parameterName || "oauth_timestamp";
var scripts = document.getElementsByTagName("script");

我的钛移动SDK 3.2.3 GA,我的测试平台是iOS 7.1模拟器。

提前谢谢。

1 个答案:

答案 0 :(得分:0)

不确定这是否是您正在寻找的,但我正在使用我的这个应用。

基本上它是一个失败优雅的概念,如果用户:

  • 安装了Twitter应用程序,它将打开iOS的原生集成(尚未经过Android测试)
  • 否则,它将打开浏览器并使用Twitter意向网址发布(使用户登录但仍保留填充的Twitter消息。

`

//check to see if the user can open a test url schema
if(Ti.Platform.canOpenURL('twitter://post?message=test'))
{
    //if the user can, then encode the message and open the native integration
    var twitterShareText = encodeURIComponent('Your Twitter message here'); 
    Ti.Platform.openURL('twitter://post?message=" + twitterShareText);

}else
{
    //create a url for Twitter share (then open twitterShareURL in browser)
    `var twitterShareURL = 'https://twitter.com/intent/tweet?';
        twitterShareURL += 'text=' + encodeURIComponent('Your Twitter message here');
        twitterShareURL += 'url=' + encodeURI('http://theurlthatyouwanttoshare.com'); //(optional)
}