是否可以将Alamofire与Yelp Search API一起使用?如果是这样,您如何生成OAuth签名?这是我正在努力工作的代码片段。提前谢谢。
func searchForBusinessesByLocation(term: String, location: String) {
Alamofire.request(Method.GET, NSURL(string: "http://\(self.api_host)\(self.search_path)")!, parameters: ["term":self.searchTerm, "location":self.searchLocation,"limit":self.search_limit, "oauth_consumer_key":self.CONSUMER_KEY, "oauth_token":self.TOKEN, "oauth_signature_method":self.SIGNATURE_METHOD, "oauth_signature":self.SIGNATURE, "oauth_timestamp":self.timestamp(), "oauth_nonce":self.NONCE]).responseString(encoding: NSUTF8StringEncoding, completionHandler: {(_,_,result, error) in
if(result != nil) {
println("result \(result)")
}
else {
println("no result")
}
if(error != nil) {
println("error \(error)")
}
else {
println("no error")
}
})
}