0

我需要在没有登录的情况下获取 Twitter 页面的提要以及来自 Instagram 页面的最新图像。

我试过这个https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=QFRradio2&count=2,用于获取推文,但它返回

{"errors":[
            {
               "message":"Bad Authentication data","code":215
            }
          ]
}

无需登录即可获取页面的 Twitter 订阅源和 Instagram 图片的任何帮助。

NSDictionary    *Dic = [NSDictionary dictionaryWithObjectsAndKeys:kTwitter_oauth_access_token,@"oauth_access_token",kTwitter_oauth_access_token_secret, @"oauth_access_token_secret",kTwitter_consumer_key,@"consumer_key",kTwitter_consumer_secret,@"consumer_secret", nil];
    NSString *string = [Dic JSONRepresentation];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[ NSURL URLWithString: @"https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=QFRadio2&count=2&"]
                                                           cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
    NSData *data = [NSData dataWithBytes: [string UTF8String] length: [string length]];
    [request setHTTPMethod: @"POST" ];
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
    [request setHTTPBody: data];

    NSURLConnection *connection = [[NSURLConnection alloc]initWithRequest:request delegate:self];
    if (connection) {
        self.responseData = [NSMutableData data];
    }
4

0 回答 0