簡體   English   中英

如何使用Mobile Safari中的鏈接使用Twitter應用程序打開用戶的Twitter個人資料?

[英]How do I open a user's Twitter profile using the Twitter app using a link in Mobile Safari?

看起來Twitter注冊了twitter://的URI方案,但在玩了之后我無法直接打開用戶的個人資料。 我試過了:

twitter://username
twitter://user/username
twitter://profile/username

沒有運氣。 我也需要它才能在Android上運行。

思考?

我為twitter tweetie找到了兩個URL方案://twitter://

tweetie:///user?screen_name=jessicaalba
twitter:///user?screen_name=jessicaalba

在這個wiki網站上,你可以找到很多其他的iPhone網址(包括推特)

似乎沒有在任何地方正式記錄,所以我不會指望支持它的Twitter應用程序的所有版本,但http://groups.google.com/group/twitter-development-talk/browse_thread/thread/92b958b7af002993?pli = 1給出一個值得嘗試的提示:

我剛剛發現“twitter:/// user?screen_name = tvdw”也可以。

我知道你正在尋找專門用官方Twitter應用程序打開它,但如果這個人沒有應用程序,那么該功能將無法在您的應用程序中運行。

為什么不在這種情況下使用MGTwitterEngine,因為它適用於所有人,它將保留在您的應用程序中?

對於那些想知道如何測試該方案是否執行的人:

- (BOOL)openURL:(NSString *)url
- (void) clickTwitter {
    if (![self openURL:@"twitter:///user?screen_name=mufumbo"]) {
        if (![self openURL:@"tweetie:///user?screen_name=mufumbo"]) {
            [self openURL:@"http://twitter.com/mufumbo"];   
        }
    }
}

你可以包含更多,並使其成為通用循環。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM