Gig 0.1

Gig 0.1

测试已测试
语言语言 Objective-CObjective C
许可证 MIT
发布最后发布2014年12月

Guille Gonzalez维护。



Gig 0.1

  • Guillermo Gonzalez

Gig提供Twitter 1.1 API的异步块封装Objective-C包装器。它使用Mantle来模型化Twitter平台对象,并使用AFNetworking来执行API请求。

状态

Gig仍在进行中。已经完全实现了Tweets、Users、Entities和Places的模型。至于API,Gig目前实现了时间线和与推文相关的方法。其余的方法将在以后的时间内实现(欢迎pull requests!)。

示例代码

认证

Gig使用Accounts Framework来认证API请求。只需使用一个ACAccount对象来初始化您的客户端,所有请求都将使用该账户签名。

GIGClient *client = [[GIGClient alloc] initWithAccount:account];

时间线

使用-fetchTimeline:parameters:completion方法从Twitter时间线获取推文。

// Fetch the two most recent tweets in my home timeline
[client fetchTimeline:GIGTimelineHome parameters:@{
        GIGCountKey : @2
} completion:^(NSArray *tweets, NSError *error) {
    for (GIGTweet *tweet in tweets) {
        NSLog(@"%@: %@", tweet.user.screenName, tweet.text);
    }
}];

推文

// Update status

[client updateStatusWithText:@"Hello world!!!" parameters:nil completion:^(GIGTweet *tweet, NSError *error) {
    NSLog(@"statusID: %@", tweet.statusID);
}];
// Update status with media

NSData *data = UIImageJPEGRepresentation(picture, 1.0);
[client updateStatusWithText:@"Hello world!!!" media:data parameters:nil completion:^(GIGTweet *tweet, NSError *error) {
    GIGMedia *media = tweet.entities.media[0];
    NSLog(@"statusID: %@, mediaID: %@", tweet.statusID, media.mediaID);
}];

联系

Guillermo Gonzalez
@gonzalezreal

许可证

Gig遵循MIT许可证发布。请参阅LICENSE.md