要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
。
Snape_iOS 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "Snape_iOS"
在您的类中实现 UISnapeDelegate
然后初始化 snape 的代码(示例)
snape = [UISnape new];
[self.view addSubview:snape];
snape.frame = self.view.frame;
snape.delegate = self;
当 snape 准备就绪时,将运行代理方法
- (void)snapeReadyForTest:(UISnape *)snape
可用于 HTTP 测试或其他功能,例如 HurryPorter HTTP 测试的示例
[snape test:@"Post Test" code:^UISnapeTestResult(UISnape *s, SnapeTaskObject *task, NSString *jobId){
HurryPorter *porter = [[HurryPorter alloc] init];
[porter makeRequest:^NSDictionary*(HurryPorter *porter){
return @{@"First Name":@"Hurry",
@"Last Name":@"Porter"};
} onSuccess:^void HUP_PARAM_SUCCESS{
NSLog(@"success resp:%@", raw);
NSLog(@"json is:%@", dict);
[task success];
} onFailed:^void HUP_PARAM_FAILED{
NSLog(@"failed resp:%@", raw);
[task failed];
} url:@"http://www.myandroid.tw/test/post.php"];
return WAIT_FOR_RESULT;
}];
Seachaos, [email protected]
Snape_iOS 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。