views:

40

answers:

4

Hi, everyone,

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.

+1  A: 

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

carthee
@carthee, thank you for your reply. And I still have some problems about the statement. After I set the URL (like the above). What can I call the server?
Questions
+1  A: 

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

carthee
@carthee, thank you for your reply. Can I set the type of the server? As I want to connect the CalDav and CardDav server in order to get the address book and calendar data. Is it also possible? Thank you.
Questions
+1  A: 

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 and here. If you go through http://www.iphonesdkarticles.com you can find enough code and examples for both cases.

domino
@domino, thank you for your reply. Actually, I want to connect to the CardDav and CalDav server and download some address book and calendar information to my app. Is it also user the NSURLConnect to achieve this part? Thank you.
Questions
Caldav and CardDav are simply xml data returned by the servers based in http, so yes you should be able to download, parse the data and use it for whatever you need to do
domino
A: 

Replace the url with the server you want..

carthee