我正在学习Objective-C,我正在尝试将图片上传到microsoft vision api
我已将这些用作标题
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPMethod:@"POST"];
[request addValue:@"{*************}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
我从服务器收到此消息
{ "statusCode": 401, "message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription." }
我尝试重新生成密钥,我很确定我正在使用正确的密钥。
答案 0 :(得分:1)
您需要删除花括号,特别是:
[request addValue:@"*************" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];