-1
我是新來iphone ....當我需要連接到一個Web服務我使用的是follwing代碼是使用ASIHTTP請求..當我添加此代碼它的未來錯誤如何connectASIHTTPRequest爲WebService
ASIHTTPRequest未申報聲明它第一個我shd申報和wat我shd聲明?我正在使用UIViewController類
我怎麼shd申報?笏我SHD辦?PLZ建議我下面
-(void)callWebService
{
//this is a typical url for REST webservice, where you can specify the method that you want to call and the parameters directly with GET
NSURL *url = [NSURL URLWithString:@"http://www.yourserver.net/webservice/rest/?method=myMethod&par1=ok"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDidFinishSelector:@selector(requestCompleted:)];
[request setDidFailSelector:@selector(requestError:)];
[request setDelegate:self];
[request startAsynchronous];
}
- (void)requestCompleted:(ASIHTTPRequest *)request
{
NSString *responseString = [request responseString];
}
- (void)requestError:(ASIHTTPRequest *)request
{
NSError *error = [request error];
}
代碼給出感謝ü...
,你必須附加在你的項目asihttp包
@Abhilash是你的問題解決了。 – Gypsa 2011-06-13 05:38:57
@Abhilash框架文件夾右鍵單擊選擇添加現有的框架彈出將顯示那裏你會得到它。 – Gypsa 2011-06-13 05:46:36
謝謝你...如何添加ashihttp包?以及此MobileCoreServices和libz框架位於我沒有得到它 – Abhilash 2011-06-13 05:47:04