2011-07-23 24 views
0

ASIHTTPRequestを介してフォームフィールドデータ(名前、電子メール、電話番号、スコア)を投稿する方法。私はjson webservicesを使用しています。iphoneでASIHTTPRequest経由でデータを投稿する方法

+1

ASIHTTPRequestのよく書かマニュアルを参照してみましたか? – Till

+0

私に返信してくれてありがとう@Till .. NSMutableURLRequestの代わりにASIHTTPRequestを使用していますが、ASIHTTPRequestのようにエラーが返されます。 – Pinku

+0

NSURL * urlString = [NSURL URLWithString:@ "http://www.nieuwe-dag.nl/mobile_be/public/?action=saveScore"]; \t ASIHTTPRequest * request = [ASIHTTPRequest requestWithURL:urlString]; – Pinku

答えて

1

あなたのヘッダークラ​​ス

ASIFormDataRequest * requestASIに変数を割り当て、これを試してみてください。あなたの.mファイル内

-(void)startASIRequest { 

NSString *strUrl = [NSString stringWithFormat:@"http://your url"]; 

NSURL *url = [NSURL URLWithString:strUrl]; 

[self setRequestASI:[ASIFormDataRequest requestWithURL:url]]; 

[requestASI setDelegate:self]; 

[requestASI setRequestMethod:@"POST"]; 

[requestASI setPostValue:@"1" forKey:@"name"]; 

[requestASI setDidFailSelector:@selector(uploadFailed:)]; 

[requestASI setDidFinishSelector:@selector(uploadFinished:)]; 

[requestASI startAsynchronous]; 


    - (void)uploadFinished:(ASIHTTPRequest *)theRequest { 

NSLog(@"registerFinished %@",[theRequest responseString]); 

    } 

    - (void)uploadFailed:(ASIHTTPRequest *)theRequest { 

NSLog(@"registerFailed %@", [theRequest error]); 

}

+0

'%D 'の前に期待指定-修飾子リスト?あなたは '%@'を意味すると思います。 –

+0

@xcodeDev:ありがとう、申し訳ありません、ただタイプミス! – Karthikeyan

+0

作成時に9エラーが発生するASIFormDataRequest * requestASI; .hファイルに – Pinku

関連する問題