let key = ""
let secret = ""
let data = ["platform":"all","audience" : ["alias" : ["162625"]],"message" : ["msg_content" : "Hi,JPush","content_type" : "text","title" : "msg","extras" : ["key": "value"]]] as [String : Any]
let path = "https://api.jpush.cn/v3/push"
varheaders:HTTPHeaders= [:]
ifletauthorizationHeader =Request.authorizationHeader(user: key, password: secret) {
headers[authorizationHeader.key] = authorizationHeader.value
}
Alamofire.request(path, method: .post, parameters: data, encoding:JSONStringArrayEncoding(array: data), headers: headers)
.authenticate(user: key, password: secret)
.validate(contentType: ["application/json"])
.responseJSON{ responsein
ifletJSON = response.result.value{
print("JSO: \(JSON)")
}
}
网友评论