我正在尝试在我的应用程序中实现一个错误报告页面。用户提供用户名和密码以及错误标题和描述,然后我进行REST(大声笑)。无论如何,这是我的代码:
+(void)reportBug:(NSString *)username password:(NSString *)password title:(NSString *)title description:(NSString *)body completion:(void (^)(id))completion{
NSDictionary *myDict = @{@"body" : body, @"title" : title, @"assignee" : username};
AFHTTPSessionManager *session = [[AFHTTPSessionManager alloc]initWithBaseURL:[NSURL URLWithString:@"https://api.github.com"] sessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
[session POST:@"/repos/AFNetworking/AFNetworking/issues" parameters:myDict constructingBodyWithBlock:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
NSLog(@"everything is %@", responseObject);
} failure:^(NSURLSessionDataTask *task, NSError *error) {
completion (error);
}];
}
我并不是真的很清楚文档,但也许我只是愚蠢。我收到此错误:
Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: not found (404)" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7f8a92a1de40> { URL: https://api.github.com/repos/AFNetworking/AFNetworking/issues } { status code: 404, headers {
"Access-Control-Allow-Credentials" = true;
"Access-Control-Allow-Origin" = "*";
"Access-Control-Expose-Headers" = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval";
"Content-Encoding" = gzip;
"Content-Security-Policy" = "default-src 'none'";
"Content-Type" = "application/json; charset=utf-8";
Date = "Sun, 10 Jan 2016 16:20:51 GMT";
Server = "GitHub.com";
Status = "404 Not Found";
"Strict-Transport-Security" = "max-age=31536000; includeSubdomains; preload";
"Transfer-Encoding" = Identity;
"X-Content-Type-Options" = nosniff;
"X-Frame-Options" = deny;
"X-GitHub-Media-Type" = "github.v3";
"X-GitHub-Request-Id" = "51AB3A71:12180:25A43C4:569284E3";
"X-RateLimit-Limit" = 60;
"X-RateLimit-Remaining" = 46;
"X-RateLimit-Reset" = 1452445261;
"X-XSS-Protection" = "1; mode=block";
} }, NSErrorFailingURLKey=https://api.github.com/repos/AFNetworking/AFNetworking/issues, com.alamofire.serialization.response.error.data=<7b226d65 73736167 65223a22 4e6f7420 466f756e 64222c22 646f6375 6d656e74 6174696f 6e5f7572 6c223a22 68747470 733a2f2f 64657665 6c6f7065 722e6769 74687562 2e636f6d 2f76332f 69737375 65732f23 63726561 74652d61 6e2d6973 73756522 7d>, NSLocalizedDescription=Request failed: not found (404)}
最佳答案
您必须经过身份验证才能发布新问题。
关于ios - 创建新一期GitHub iOS,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34707898/