开发者

Connection code to connect iphone to web server [closed]

开发者 https://www.devze.com 2023-01-23 11:30 出处:网络
开发者_StackOverflow社区 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its curr
开发者_StackOverflow社区 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

Can anyone help me to connect iphone to web server??


Use ASIHTTPRequest for example as a library (to make it easier). You can even send POST requests to the website with the encoded parameters (see the documentation on the website).


you can always use NSURLRequest to build your request and NSURLConnection to start the connection.


I concur with Istvan, use ASIHTTPRequest for you calls. If you want more detail on how to write a local API in Objective-C, I wrote a blog post about this (uses ASIHTTPRequest as well, but is more about program design than the API itself):

http://longweekendmobile.com/2010/10/15/how-to-consume-json-or-xml-web-apis-on-iphone-smoothly/


Use this NSXMLParser Delegate method too

-(void)parseWithContentsofUrl:(NSURL*)url {

isParsingFinished = false;
rssParser = [[[NSXMLParser alloc] initWithContentsOfURL:url] autorelease];
[rssParser setDelegate:self];
[rssParser setShouldProcessNamespaces:NO];
[rssParser setShouldReportNamespacePrefixes:NO];
[rssParser setShouldResolveExternalEntities:NO];
[rssParser parse];

}

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号