查看 Twist 'n' Slide 源代码。
iOS 7 或更高版本要求。
Talkable 通过 CocoaPods 可用。要安装它,只需将以下行添加到您的 Podfile 中
pod "Talkable", "~> 0.1"
在 didFinishLaunchingWithOptions
中设置您的凭据,如下所示
Talkable *talkable = [Talkable sharedInstance];
[talkable setApiKey:@"XXXXX" andApiSlug:@"your-app-name"];
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 文件。