我正在尝试进行 yelp 查询并使用 OAuth Lib
这是代码
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://api.yelp.com/v2/search?term=petrol+restaurants&ll=%f,%f&radius_filter=300",coordinate.latitude,coordinate.longitude]];
OAConsumer *consumer = [[OAConsumer alloc] initWithKey:consumerKey secret:consumerSecret];
OAToken *token = [[OAToken alloc] initWithKey:tokenUrl secret:tokenSecret];
id<OASignatureProviding, NSObject> provider = [[OAHMAC_SHA1SignatureProvider alloc] init];
NSString *realm = nil;
OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:URL
consumer:consumer
token:token
realm:realm
signatureProvider:provider];
[request prepare];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
connection = nil;
如果查询有一个术语,则代码可以完美运行,term=petrol
例如但是如果我添加两个术语,就像term=petrol+fuel
它开始给我错误一样{"error": {"text": "Signature was invalid", "id": "INVALID_SIGNATURE", "description": "Invalid signature
这段代码有什么问题?
示例 API 请求
http://api.yelp.com/v2/search?term=cream+puffs&location=San+Francisco
iTS 包含一个 + 但当我使用 + 时,它给了我以上错误