私はyelpクエリを実行しようとしていますが、OAuthLibを使用しています
これがコードです
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;
クエリに1つの用語がある場合、コードは完全に機能します。term=petrol
たとえば、2つの用語を追加すると、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には+が含まれていますが、+を使用すると、上記のエラーが発生します