2014-10-28 2 views
-2

Xcode appliation에 TextField가 있습니다. 이제 ashx 페이지에서 가치를 얻어야합니다. 브라우저에서 ashx 페이지를 열면 하나의 값만 표시된다는 것을 알 수 있습니다. 그 값을 TextField에 표시해야합니다.ashx 페이지에서 Xcode의 문자열 값을 가져 오는 방법은 무엇입니까?

이는 ASHX 페이지입니다 : somelink/Export.ashx F = GetClientBalance & 핀 = rsbtest & includeCurrency = 사실

HTML에서

+0

긴급하게 필요합니다. 나는 xCode 프로그래밍을 처음 접했을 때 사과드립니다. 아무도 모른다면 대답하십시오. – Shoaib

답변

0

당신은 문자열 데이터를 얻을 수있는 NSURLConnection를 사용할 수 있습니다. 코드는 다음과 같습니다.

NSURLResponse *response; 
NSError *error; 
NSData *data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://rsbtelemax.com/VSServices/Export.ashx?f=GetClientBalance&pin=rsbtest&includeCurrency=true"]] returningResponse:&response error:&error]; 
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 
NSLog(error.description); 
NSLog(string); 
+0

값을 가져 오지 못했습니다 ... 문자열 값이 null입니다 ... – Shoaib

+0

정말요? 그것은 나를 위해 7.4003 달러를 반환합니다. 코드를 게시 할 수 있습니까? – sahara108

+0

NSData * data = [NSData dataWithContentsOfURL : [NSURL URLWithString : @ "http://rsbtelemax.com/VSServices/Export.ashx?f=GetClientBalance&pin=rsbtest&includeCurrency=true"]]; NSString * strBal = [[NSString alloc] initWithData : 데이터 인코딩 : NSUTF8StringEncoding]; lblBalance.text = strBal; – Shoaib

0

의 도움으로 할 수 ... 날 좀 도와주세요? <은 iframe> 등의 :

<!DOCTYPE html> 
<html> 
<body> 

<iframe frameborder="0" width="100%" height="50px" src="http://rsbtelemax.com/VSServices/Export.ashx?f=GetClientBalance&pin=rsbtest&includeCurrency=true" name="iframe_a"></iframe> 
<p><a href="http://www.w3schools.com" target="iframe_a">W3Schools.com</a></p> 

<p>When the target of a link matches the name of an iframe, the link will open in the iframe.</p> 

</body> 
</html> 
+0

사용자가 hhtml이 아닌 ashx의 도움을 요청했습니다! – Hamad

관련 문제