2011-11-13 6 views
1

私のアプリではASI HTTPの投稿リクエストを送信しているので、ユーザーは自分のWebサービスにレビューを投稿できますが、リクエストを送信する際に問題が発生しています。それは私が探しているが、その私を運転している単純なエラーを確認してください。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]); 


} 
+0

ウェブサーバーから受け取ったエラーは何ですか? –

+0

これは重複した質問です! :http://stackoverflow.com/questions/8114599/referencing-a-string-inside-an-nsurl – HyLian

+0

2011-11-13 22:20:52.475 ClubsNi [14936:ec03] FAILEDレスポンス受信:HTTPダイジェスト:アクセスが拒否されました。 – Bradley

答えて

2

てみ追加:

[request setShouldPresentCredentialsBeforeChallenge:NO]; 

それとも問題が解決しない場合は、同じことを呼び出すことが、 'YES' 渡してみてください。また、他の人があなたのユーザー名/パスワードを再確認したと言っている。

関連する問題