Talkable 0.2.0

Talkable 0.2.0

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年1月

Dmitry Krasnoukhov 维护。



Talkable 0.2.0

  • Dmitry Krasnoukhov

例子

查看 Twist 'n' Slide 源代码。

要求

iOS 7 或更高版本要求。

安装

Talkable 通过 CocoaPods 可用。要安装它,只需将以下行添加到您的 Podfile 中

pod "Talkable", "~> 0.1"

配置

didFinishLaunchingWithOptions 中设置您的凭据,如下所示

Talkable *talkable = [Talkable sharedInstance];
[talkable setApiKey:@"XXXXX" andApiSlug:@"your-app-name"];

库 API

Talkable 库提供了以下接口

- (void)createOrigin:(NSDictionary *)params withHandler:(void(^)(NSDictionary *response))handler;
- (void)retrieveRewards:(NSDictionary *)params withHandler:(void(^)(NSDictionary *response))handler;
- (void)retrieveOffer:(NSDictionary *)params withHandler:(void(^)(NSDictionary *response))handler;
- (void)createShare:(NSDictionary *)params withHandler:(void(^)(NSDictionary *response))handler;

并且有助手方法

- (NSString *)deviceId;
- (NSString *)visitorId;
- (SLComposeViewController *)socialShareFor:(NSString *)channel withOffer:(NSDictionary *)offer;
- (UIActivityViewController *)nativeShareFor:(NSString *)channel withOffer:(NSDictionary *)offer withUrl:(NSString *)url;

有关更多详细信息,请参阅 Talkable API 文档。

例子

创建一个原始并检索报价

Talkable *talkable = [Talkable sharedInstance];
[talkable createOrigin:@{
    @"type": @"Event",
    @"data": @{
        @"event_number": [talkable deviceId],
        @"uuid": [talkable visitorId],
        @"event_category": @"app-invite-friends",
        @"campaign_tags": @"ios"
    }
} withHandler:^(NSDictionary *response) {
    // Use `response`

    [talkable retrieveOffer:@{
        @"offer": [response objectForKey:@"offer"],
        @"interpolations": @[@"incentives", @"claim_urls", @"share_via_email_subject"]
    } withHandler:^(NSDictionary *response) {
        // Use `response`
    }];
}];

作者

Dmitry Krasnoukhov, [email protected]

许可证

Talkable 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。