I am new to iPhone application development and working on a web service based application.
I am using NSXML parser in this application and all is working finr, I am able to get the data from server.
But my friend told me that I should include ASIHTTP Classes in this project that is mandatory, but I wonder as I have not used any usch classes as of now and still i am able to fetch the data successfully.
Can any body please explain me what is the purpose of ASIHTTP classes and if i don't use it then would that be a right approach?
I will also need to do Lazy loading in my project so will that be possible without ASIHTTP Classes?
Please help me to clear my doubts.
Thanks in advance.
iPhone Developer
You can obtain any information you're looking for from here, ASIHTTPRequest - How To Use
Alternatively, you can use NSURLConnection
Both routes you can use Asynchronous request to perform lazy loading.
Related
I'm not sure this question is appropriate here but I hope I could get some help. What i'm looking to do is basically to make a server based iPhone application. I've got an ubuntu server ready to be used. I'm thinking of making a web service which my application then can use but I have virtually no experience in this field so i'm looking for some help to get pointed into the right direction, what language to write the web service in etc. It isn't required to be a web service but anything that make's the iPhone app depending on the server.
This little mission is simply for learning experience.
Probably PHP is what you will use to write the webservice. REST based services are the most popular, but it could be as simple as a form POST passing in parameters. The PHP script (no matter which way you write it), will then pass those parameters and any other needed info to a server method that either executes a SQL query (preferably using a stored procedure) or uses some other server resource. That data would then be output via the webservice as either XML or JSON (I personally like JSON better).
Check out Ray Wenderlich's tutorial on just this kind of thing:
When it comes time to handle the request in iOS, my personal choice is AFNetworking. It uses blocks instead of delegate methods and is blazing fast. I can hook you up with examples if needed.
Ok, First you need to learn how to write web services in PHP. Which will return you response in XML format. I personally prefer .PLIST format because it gets easier to parse on the iOS.
Once your web services are up and running. You need to use NSURLConnection and NSURLRequest to talk to your web services. Implementing the NSURLConnection Delegate methods correctly, you can download your XML response, maybe save it in a file on your Documents Directory.
Then once done downloading start parsing that response using NSXMLParser. implementing the delegates and what not, you can create your data structure the way you feel comfortable with manipulating it and store the parsed results in them and populate your View accordingly.
My original question regarding Consuming Custom Request Methods with Android seems to have garnered very little attention -- I have converted it to an Android specific question
So, quite simply, with iOS5 development, is it possible to consume custom request methods?
If so, how.
The "standard" set of request methods, as per RFC-2616 are:
GET
PUT
POST
DELETE
TRACE
CONNECT
I would like to add another, called SEARCH. On the API, using PHP or Java, this is easy to implement in PHP. The consumption of this new request method is proving to be a challenge for an iOS developer.
Does anyone have any references to working examples or frameworks that will support a custom request method, such as SEARCH, or FOOBAR?
ASIHTTPRequest allows it: http://allseeing-i.com/ASIHTTPRequest/How-to-use
Check out the 'PUT requests and custom POSTs' section.
[request setRequestMethod:#"SOME_REQUEST_METHOD"];
I am developing application in iPhone, Where i need to download and upload data from webservice. Please advice me which is the best class or Framework to achieve this and also please let me know which is the best xmlparser.
you can use asihttprequest and asihttpresponse for establishing connection use restful api and nxxml parser for parsing the data comes from server
thanks
NSXMLParser is a SAX parser included by default with the iPhone SDK.
TouchXML is an NSXML style DOM XML parser for the iPhone.
If your web service has the ability to return json, I would highly recommend doing so and using http://code.google.com/p/json-framework/. Especially if you have a complex XML document.
As for connecting to the service, it's pretty straightforward - all you need is a method to handle the connections. While there are 'frameworks' out there, it's as simple as creating a method such as "getDataFromService:(nsstring *)param1" and within that method issuing a request.
I think the bigger question you'll need to answer is how to authenticate with the service, if required. If the service uses OAuth, http://code.google.com/p/gtm-oauth/ is a great framework.
Hi i am new in iphone development. i have task to develop the application to get the web service.
I try to find source but i found some source but it cant give me any output.
So please help me and provide any example if it is possible.
I use ASIHTTPRequest for most network needs. However, it does not directly support SOAP. I don't know of any iPhone library that does. If you can address your web service without the overhead of SOAP then ASIHTTPRequest will make it simple for XML or JSON. If you really have no choice but to use SOAP then the following may help
http://devmylife.com/?p=111
we were asked to develop an iphone app like the one in the figure.
The problem is: we have no experience in IOS development.
For the basic part I can handle the learning curve, but i need suggestions, best practices on the UIKit model and controls.
This is a newspaper app.
The accordion control shows/hides content based on categories retrieved by an ASP .NET CMS on which we have no control.
I can suggest to the CMS holder to develop a couple of web services (WCF) but i'm not sure how to interface iOS with MS technology.
Furthermore, i have the idea that simple aspx that returns XML/JSON data will be easier to call, and support, but slightly less secure.
So, suggestions? Tutorials?
If you like to use JSON and a very good HTTP-request-framework I have two links for you. Both sites contain various tutorials on how to use them.
json-framework
ASIHTTPRequest
Concerning the request and delegate stuff: For a start, I would skip the delegate part and use a synchronized HTTP request called in a thread (you'll see what that is on the second website). That makes the response handling a lot easier for the start. But I personally think, that using an asynchronous request is not a must. It's just nicer, if the architecture allows it. In my application, it wasn't realizable without lots of code overhead.
You want to output an XML feed in "plist" format (look it up, its simple theres lots of info on it).
Then you can do:
NSArray *plistContents = [NSArray arrayWithContentsOfURL:[NSURL URLWithString:#"http://theinternet.com/pathToMyPlist.asp"]];
That will get all the output into an array.
Some other resources you may find interesting/useful include NSURLRequest and NSURLConnection. For the latter you will have to learn about delegate methods and such - its complicated, but its incredibly useful information.
We did several applications here using XML parsing like what you're suggesting at the end of your question. If you are concerned about security, you can implement handshaking or other security measures over that.
EDIT: XML parsing done using NSURLConnection to gather the content and NSXMLParser/NSXMLParserDelegate to do the actual parsing.
EDIT2: There is an official sample, called SeismicXML from Apple. It should get you started with iPhone XML parsing and data downloading.