我需要你的帮助。我在 MaShape 上为 Metascore 找到了一个 API,但我无法让它工作。我使用 Cocoapod 下载 Unirest 框架并从 Mashape 复制粘贴代码片段
NSDictionary* headers = @{@"X-Mashape-Authorization": @"wZrjWIiAsqdSLGIh3DQzrKoZ5Y3wlo6E"};
NSDictionary* parameters = @{@"title": @"The Elder Scrolls V: Skyrim", @"platform": 1, };
UNIHttpJsonResponse* response = [[UNIRest post:^(UNIBodyRequest* request) {
[request setUrl:@"https://byroredux-metacritic.p.mashape.com/find/game"];
[request setHeaders:headers];
[request setParameters:parameters];
}] asJson];
它给了我一堆错误,我将其修复为:
NSDictionary* headers = @{@"X-Mashape-Authorization": @"wZrjWIiAsqdSLGIh3DQzrKoZ5Y3wlo6E"};
NSDictionary* parameters = @{@"title": @"The Elder Scrolls V: Skyrim", @"platform": @"1", };
UNIHTTPJsonResponse* response = [[UNIRest post:^(UNISimpleRequest* request) {
[request setUrl:@"https://byroredux-metacritic.p.mashape.com/find/game"];
[request setHeaders:headers];
[request setParameters:parameters];
}] asJson];
但是每当我去调试代码并查看响应时,它都是空的,就好像 api 没有工作一样。你们能告诉我我做错了什么吗?
谢谢