Latest 0.1.3
Homepage https://github.com/bluedarker/ShowAPI_SDK
License MIT
Platforms ios 8.0
Dependencies AFNetworking
Authors

CI Status
Version
License
Platform

Example

To run the test example project, clone the repo, and run pod install from the Example directory first.

Then run Tests/Tests.m in XCode

Requirements

Installation

ShowAPI_SDK is available through CocoaPods. To install
it, simply add the following line to your Podfile:

use_frameworks!
pod "ShowAPI_SDK"

Usage

首先需要导入“ShowAPI_SDK”

#import <ShowAPI_SDK/ShowAPIRequest.h>

普通方式请求showapi数据,这里以彩票数据为例

//创建请求实例
//这里需要替换为你自己的appid和secret,你可以在这里找到 https://www.showapi.com/app/editApp
ShowAPIRequest *request=[[ShowAPIRequest alloc] initWithAppid:@"appid" andSign:@"secret" ];

//调用彩票开奖查询api
[request post:@"https://route.showapi.com/44-1"//最新开奖接入点的接口url,注意您需要先订购该接口免费套餐才能测试
timeout:20000//超时设置为20秒
params:[[NSDictionary<NSString*,NSString*> alloc] initWithObjectsAndKeys:@"ssq",@"code", nil]//传入特定参数查询双色球最新开奖信息
withCompletion:^(NSDictionary<NSString *,id> *result) {
//打印返回结果

NSData *jsonData = [NSJSONSerialization dataWithJSONObject:result options:NSJSONWritingPrettyPrinted error:nil];
// NSData转为NSString
NSString *jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];

NSLog(@"返回结果为:%@",jsonStr);

}];

带上传文件方式请求showapi数据,这里以二维码识别为例

//文件需要换为你自己的测试文件
NSURL *filePath = [[NSBundle mainBundle] URLForResource:@"showapi" withExtension:@"jpg"];
NSData *imgData = [[NSData alloc] initWithContentsOfURL:filePath];
//    NSLog(@"img is:%@",imgData);

//创建请求实例
//这里需要替换为你自己的appid和secret,你可以在这里找到 https://www.showapi.com/app/editApp
ShowAPIRequest *request=[[ShowAPIRequest alloc] initWithAppid:@"appid" andSign:@"secret" ];

//验证码识别api
[request post:@"https://route.showapi.com/887-2"//验证码识别接口地址,注意您需要先订购该接口免费套餐才能测试
timeout:20000//超时设置为20秒
params:[[NSDictionary<NSString*,NSString*> alloc] initWithObjectsAndKeys:@"1",@"handleImg", nil] //普通传入参数
fileParams:[[NSDictionary<NSString*,NSData*> alloc] initWithObjectsAndKeys:imgData,@"img", nil] //文件参数
withCompletion:^(NSDictionary<NSString *,id> *result) {
//打印返回结果

NSData *jsonData = [NSJSONSerialization dataWithJSONObject:result options:NSJSONWritingPrettyPrinted error:nil];
// NSData转为NSString
NSString *jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];

NSLog(@"返回结果为:%@",jsonStr);

} ];

Author

bluedarker, [email protected]

License

ShowAPI_SDK is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ShowAPI_SDK",
    "version": "0.1.3",
    "summary": "SDK for invoke api from www.showapi.com",
    "description": "*Simple SDK for invoke api from www.showapi.com",
    "homepage": "https://github.com/bluedarker/ShowAPI_SDK",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "bluedarker": "[email protected]"
    },
    "source": {
        "git": "https://github.com/bluedarker/ShowAPI_SDK.git",
        "tag": "0.1.3"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ShowAPI_SDK/Classes/**/*",
    "dependencies": {
        "AFNetworking": [
            "~> 3.0"
        ]
    }
}

Pin It on Pinterest

Share This