gpt4 book ai didi

iphone - 用于发布评论的 ASI HTTP 请求

转载 作者:行者123 更新时间:2023-11-29 11:19:03 24 4
gpt4 key购买 nike

在我的应用程序中,我发送了一个 ASI HTTP 发布请求,这样我的用户就可以向我的网络服务发布评论,但是我在发送请求时遇到了一些问题,它似乎总是失败我确信这是一个简单的错误我过目不忘,但它驱使着我。

我的创建复习类如下:

-(void)Submit
{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://furious-ice-356.heroku.com/places/%@/reviews.xml",self.identifier]];


//[NSURL URLWithString:[NSString stringWithFormat:@"https://furious-ice-356.heroku.com///places/%@/reviews.xml",self.identifier]];


self.bestnight.text = @"Monday";
ASIFormDataRequest *request1 = [ASIFormDataRequest requestWithURL:url];

[request1 setUsername:self.username];
[request1 setPassword:self.password];

[request1 setRequestMethod:@"POST"];


[request1 setPostValue:self.bestnight.text forKey:@"review[best-night]"];
[request1 setPostValue:self.comments.text forKey:@"review[comments]"];
[request1 setPostValue:self.rating.text forKey:@"review[rating]"];

[request1 setDelegate:self];
[request1 startAsynchronous];

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

}


- (void)requestFinished:(ASIHTTPRequest *)request
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
NSLog(@"FINISH Response received: %@", [request responseString]);

UIAlertView * av = [[[UIAlertView alloc] initWithTitle:@"Thank You" message:@"Your review was successfully posted. Thank You for making our App Better." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] autorelease];

[av show];

[self.navigationController popViewControllerAnimated:YES];

}

- (void)requestFailed:(ASIHTTPRequest *)request
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
NSLog(@"FAILED Response received: %@", [request responseString]);


}

最佳答案

尝试添加:

[request setShouldPresentCredentialsBeforeChallenge:NO];

或者,如果这不起作用,请尝试调用相同的方法但传递"is"。也正如其他人所说,仔细检查您的用户名/密码。

关于iphone - 用于发布评论的 ASI HTTP 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8115110/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com