[英]status code: 400 in YELP api
我正在我的應用程序中進行 Yelp 集成,我正在使用這個演示作為參考。
當我搜索@"restaurants"
它運行良好,但是當我搜索@"Shopping"
它給出了以下響應:
{ status code: 400, headers {
"Cache-Control" = private;
"Content-Length" = 123;
"Content-Type" = "application/json; charset=UTF-8";
Date = "Mon, 06 Jul 2015 10:28:37 GMT";
Server = Apache;
Vary = "User-Agent";
"X-Mode" = ro;
"X-Node" = "web16-uswest1bprod, api_com";
"X-Proxied" = "extlb1-uswest1bprod";
} }
我的.m文件代碼:
- (OAMutableURLRequest*) getOARequest {
NSString *realm;
OAConsumer *consumer = [[OAConsumer alloc] initWithKey: CONSUMER_KEY secret: CONSUMER_SECRET];
//passing token and token secret keys.
OAToken *token = [[OAToken alloc] initWithKey: TOKEN secret: TOKEN_SECRET];
id<OASignatureProviding, NSObject> provider = [[OAHMAC_SHA1SignatureProvider alloc] init];
//calling signature method
OAMutableURLRequest* request = [[OAMutableURLRequest alloc]
initWithURL: [NSURL URLWithString:[self getRequestURLString]]
consumer: consumer
token: token
realm: realm
signatureProvider: provider];
[request prepare];
return request;
}
- (void) getRestaurantList {
NSHTTPURLResponse* response; //this is object is used for response perpose
NSError* error;
NSData* data = [NSURLConnection sendSynchronousRequest: [self getOARequest]
returningResponse: &response
error: &error];
// If the response is all good then fill in the restaurant dictionary with
// the Yelp JSON data
NSLog(@"%@",response);
if ([response statusCode] == 200) {
//success
}
有誰知道 Yelp API 中的問題是什么?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.