我在使用 Google 融合表的 ios 应用程序上工作。在上一个问题中,我得到了建议并取得了进展,但仍在努力创建融合表。我的代码:
NSString *url = @"https://www.googleapis.com/fusiontables/v1/tables";
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:myTableDict options:NSJSONWritingPrettyPrinted error:nil];
NSString *jsonDataString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSData *postData = [jsonDataString dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
GTMHTTPFetcher *fetcher = [GTMHTTPFetcher fetcherWithRequest:request];
[fetcher setAuthorizer:self.auth];
[fetcher setPostData:postData];
void(^createHandler)(NSData *data, NSError *error) = ^(NSData *data, NSError *error){
if (error) {
NSLog(@"error creating table %@", [error localizedDescription]);
}
};
[fetcher beginFetchWithCompletionHandler:createHandler];
但我收到错误消息:“操作无法完成。(com.google.HTTPStatus 错误 400。)”。我究竟做错了什么?