How to use the iPhone connect to server?
I want to ask a question about the iPhone application. I am writing an iPhone program which can connect to a server. However, I have not ideas which library of functions should I use in order to develop this program. Can anyone help me? Thank you very much开发者_开发知识库.
What exactly are you trying to achieve once you connect to the server?
Do you just want to display a web page? If so then read up on UIWebView
Do you want to connect to your own back-end server and that supplies data to you client application on the iPhone? If so you should read up on the NSURLConnection
class.
Read up the iphone documentation for NSURLConnection and UIWebView here.
Suppose if you want to get the text from the server you can use following method
NSURL *url = [NSURL URLWithString:http://iphonedevbook.com/more/10/text.txt];
textView.text = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
actually there are other two ways to get the data from server Synchronously ASynchronously
yes,there is way to connect server.you can use the following method
NSURL *url = [NSURL URLWithString:@"http://www.w3schools.com/webservic/tempconvert.asmx"];
Regards Karthikeyan g
精彩评论