Trying to “follow” someone on Twitter using new iOS 5 API, getting 406 return error. Why?

后端 未结 4 1240
死守一世寂寞
死守一世寂寞 2020-12-23 10:10

Trying to \"follow\" someone on Twitter using new iOS 5 API, getting 406 return error. Why?

Is my code correct? Need to find out why this isn\'t working....

4条回答
  •  轮回少年
    2020-12-23 10:36

    you can use this code

    - (BOOL)openTwitterClientForUserName:(NSString*)userName {
    NSArray *urls = [NSArray arrayWithObjects:
                     @"twitter://user?screen_name={username}", // Twitter
                     @"tweetbot:///user_profile/{username}", // TweetBot
                     @"echofon:///user_timeline?{username}", // Echofon              
                     @"twit:///user?screen_name={username}", // Twittelator Pro
                     @"x-seesmic://twitter_profile?twitter_screen_name={username}", // Seesmic
                     @"x-birdfeed://user?screen_name={username}", // Birdfeed
                     @"tweetings:///user?screen_name={username}", // Tweetings
                     @"simplytweet:?link=http://twitter.com/{username}", // SimplyTweet
                     @"icebird://user?screen_name={username}", // IceBird
                     @"fluttr://user/{username}", // Fluttr
                     /** uncomment if you don't have a special handling for no registered twitter clients */
                     //@"http://twitter.com/{username}", // Web fallback, 
                     nil];
    
    UIApplication *application = [UIApplication sharedApplication];
    for (NSString *urlString in urls) {
        NSString *candidate = [urlString stringByReplacingOccurrencesOfString:@"{username}" withString:userName];
        NSURL *url = [NSURL URLWithString:candidate];
        if ([application canOpenURL:url]) {
            [application openURL:url];
            return YES;
        }
    }
    return NO;
    }
    

    https://gist.github.com/ChrisRicca/9144169

提交回复
热议问题