测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
Released上次发布 | 2016年1月 |
由 Pablo Merino 维护。
依赖于 | |
AFNetworking | ~> 2.3 |
SSKeychain | >= 0 |
NSHash | >= 0 |
要运行示例项目,克隆仓库,然后首先从 Example 目录中运行 pod install
StamperyKit 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "StamperyKit"
首先,导入库
#import <StamperyKit/StamperyKit.h>
然后,调用 +sharedInstance
方法以初始化库。
登录
NSString *emailString = @"[email protected]"
NSString *passwordString = @"some-p@ssw0rd"
[[StamperyKit sharedInstance] loginWithEmail:emailString andPassword:passwordString completion:^(id response) {
// Response contains the HTTP body
// Once logged in, [[StamperyKit sharedInstance] userProfile] will contain the user profile
} errorBlock:^(NSError *error) {
// error contains a NSError instance with the given error
}];
注册
NSString *emailString = @"[email protected]";
NSString *passwordString = @"some-p@ssw0rd";
NSString *nameString = @"John Doe";
[[StamperyKit sharedInstance] registerWithEmail:emailString password:passwordString name:nameString completion:^(id response) {
// Response contains the HTTP body
// Once logged in, [[StamperyKit sharedInstance] userProfile] will contain the user profile
} errorBlock:^(NSError *error) {
// error contains a NSError instance with the given error
}];
列出邮票 [需要登录]
[[StamperyKit sharedInstance] listStampsWithCompletion:^(id response) {
// Response will contain a NSArray containing 'Stamp' elements
} errorBlock:^(NSError * error) {
// error contains a NSError instance with the given error
}];
获取邮票详情
NSString *stampHash = @"xxx-xxx-xxx";
[[StamperyKit sharedInstance] detailsForStampHash:stampHash completion:^(id response) {
// response has an instance of Stamp, containing the specified stamp info
} errorBlock:^(NSError *error) {
// error contains the raised error
}];
盖章 此部分最终将进行更改,以使库更加非侵入式。目前,您可以通过创建 PreStamp
实例来盖章文件。
PreStamp *preStamp = [[PreStamp alloc] ...];
BOOL backupStamp = YES;
[[StamperyKit sharedInstance] stampFile:preStamp backupFile:backupStamp completion:^(id response) {
// response contains the server response
} errorBlock:^(NSError *error) {
// error contains the raised error
}];
这些都是开始使用基本功能的基本方法。查看 StamperyKit.h 了解方法列表(完全列表)。
Pablo Merino, [email protected]
StamperyKit 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。