-
微信文章精选
[Swift]- https://www.6api.net/api/weixinarticle/
- 阅读数:5322 上传时间:2020-11-21
- 示例代码
本代码示例是基于Swift的六派数据接口进行数据请求 获取频道 API服务请求的代码示例,使用前你需要:
①:通过https://www.6api.net/api/weixinarticle/ 申请API服务
以下是完整代码示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | //引入第三方库 import Alamofire import SwiftyJSON //设置请求地址与参数 let url = http: //open.liupai.net/weixinarticle/channel let parameters : Parameters = [ "appkey" : "yourappsecret" ] //Post方法 func sendAPI() { Alamofire.request(url, method: .post, parameters: parameters).responseJSON { (response) in switch response.result { case .success: let json = JSON(response.result.value!) print( "输出请求成功后返回的信息" ,json) case .failure(let error): print(error) } } } |