MGTwitterEngine 添加获取好友/id 的方法

发布于 2024-12-11 14:34:48 字数 1318 浏览 0 评论 0原文

我在添加 MGTwitterEngine 时遇到一些问题。我正在尝试添加对朋友/ID 的调用,以返回遵循 ID 的所有用户。我有一个新方法,如下所示,但没有返回任何内容。我有正确的请求类型或响应类型吗?

- (NSString *)getFriendsIds:(NSString *)twitterID
{
NSString *path = [NSString stringWithFormat:@"friends/ids.%@", API_FORMAT];

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
[params setObject:twitterID forKey:@"user_id"];

return [self _sendRequestWithMethod:nil path:path queryParameters:params body:nil 
                        requestType:MGTwitterUserInformationRequest
                       responseType:MGTwitterUsers];
}

已解决:

我最终在模型中创建了自己的方法,因为我无法让 mgtwitter 来执行此操作。它使用 ASIHttp。

- (void) getTwitterFollowIDs:(NSString *) twitter_id
{
    [self setResponse: [NSString stringWithFormat:@""]];

    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.twitter.com/1/friends/ids.json?user_id=%@", twitter_id]];
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL: url];

    // temporary during dev
    [request setValidatesSecureCertificate:NO];

    [request setDelegate:self];
    [request setDidFinishSelector:@selector(getTwitterFollowIDsDidFinish:)];
    [request setDidFailSelector:@selector(getTwitterFollowIDsDidFail:)];

    [request startAsynchronous];
}

I am having some issues adding to MGTwitterEngine. I am trying to add a call to friends/ids to return all of a users following ID's. I have a new methods as shown below, but nothing is returned. Do I have the correct requestType or responseType?

- (NSString *)getFriendsIds:(NSString *)twitterID
{
NSString *path = [NSString stringWithFormat:@"friends/ids.%@", API_FORMAT];

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
[params setObject:twitterID forKey:@"user_id"];

return [self _sendRequestWithMethod:nil path:path queryParameters:params body:nil 
                        requestType:MGTwitterUserInformationRequest
                       responseType:MGTwitterUsers];
}

Solved:

I ended up creating my own method in my model because I couldn't get mgtwitter to do it. Its using ASIHttp.

- (void) getTwitterFollowIDs:(NSString *) twitter_id
{
    [self setResponse: [NSString stringWithFormat:@""]];

    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.twitter.com/1/friends/ids.json?user_id=%@", twitter_id]];
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL: url];

    // temporary during dev
    [request setValidatesSecureCertificate:NO];

    [request setDelegate:self];
    [request setDidFinishSelector:@selector(getTwitterFollowIDsDidFinish:)];
    [request setDidFailSelector:@selector(getTwitterFollowIDsDidFail:)];

    [request startAsynchronous];
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文