我会创建一个应用程序来将我的 AdMob 收入保留在我的 iPhone 上。我已阅读API 文档并编写了一些代码。但是我对给我一个空请求的 POST 请求有问题。响应!
NSString* PostURL= [NSString stringWithFormat:@"https://api.admob.com/v2/auth/login"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:PostURL]];
[request setPostValue:APIKey forKey:@"client_key"];
[request addRequestHeader:@"Content-Type" value:@"application/x-www-form-urlencoded;"];
[request setPostValue:@"mymail@gmail.com" forKey:@"email"];
[request setPostValue:@"mypassword" forKey:@"password"];
[request setDelegate:self];
[request startSynchronous];
并使用 ASIHTTPRequestDelegate 方法获取响应:
-(void)request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data{
NSLog(@"didReceive data %@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);}
输出是一样的:didReceive data: (null)
你可以帮帮我吗?