As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am currently working with an iOS app that needs a remote interactive server.In my app i have to request some queries as well as post some data to server.Which is the right way or appropriate way to do so. which one is better REST or JSON or SOAP to do this? Is there any tutorial or documentation site?Thanks
REST is the most common way to do so.
Basically, REST relayes on simple HTTP requests & JSON,
both are very easy to use with iOS SDK.
If your model is simple, you can go straight forward with HTTP & JSON.
If it's more complicated, i recommend using REST Kit, here's a link
For straight-forward solution, if you only need a simple GET call to an existing REST API,
here are a few basic lines of code (These shouldn't run on main thread)
// Preform this on background thread
NSError *anError;
NSData *apiCallResponseData = [NSData dataWithContentsOfURL:#"http://yourdomain.com/apicall?param=value"];
NSDictionary *response = [NSJSONSerialization JSONObjectWithData:apiCallResponseData options:kNilOptions error:&anError];
//Lets say result is { "key" : "value" }
NSString *someFieldValue = response[#"key"];
//.. do what you need with the result values...
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I've put some data in a dictionary following the rules of NSJSONSerialization and I've retrieved my JSONString. How can I send this JSON object via AFNetworking to a server?
I need to pass some info from a form like name, surname, some numbers and send it to a server.
Is that possible?
AFNetworking has built in ability to do a post. Here is a tutorial with the details.
http://samwize.com/2012/10/25/simple-get-post-afnetworking/
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
i am looking at making an app for a cinema chain. i have experience in objective c but have not done may for loading data from the internet.
what i was asking is what would be the best way to load data into the app from the internet. the data will be stuff like images and names and times for the movies?
Thanks
The best way is JSON. For movies you can use http://www.omdbapi.com/. Is an unofficial api for IMDB.
The JSON response from the api can be consumed using NSURLConnection you can check apple's documentation or you can simply use RestKit.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Please can anyone help me. how to create connect to server for mail sending.
ans is http://iphonesdksnippets.com/post/2009/04/15/Send-email-with-attachments-on-iPhone.aspx
You can do it using: skpsmtpmessage
This is a nice article Sending emails from Cocoa, please check it also.
You need a middle server to receive REST call and process it in any way you want. Any iOs networking interface might be used for this purpose, there's a lot of samples how to create a simple request.
Please give more context of your question. Do you want to achieve it solely by IOS? Or you don't mind to write a bit of server code?
If you are OK to write a bit of server code, you can try Google App Engine API for sending email ( using googgle account ). You have 3 choices of language : Java, Phyton or Go.
Full documentation is located at Google App Engine website.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm converting my app from ASIHTTPRequest to AFNetworking. What should I know, in broad strokes, about how these two frameworks are different and how my app should be structured differently? For example one thing that I have found is that ASIHTTPRequest is based around #selectors, and AFNetworking is based around GCD blocks.
You've already mentioned the most important part; the difference between delegate methods of ASI and blocks in AFN.
If you implemented the ASI methods in many different classes it's fairly straightforward to move those chunks into blocks inside the same classes when you switch to AFN. Otherwise, if you've implemented some grand class which deals with all your ASI networking, be prepared to copy and paste it into the calling classes. Overall, this should benefit you greatly as it reduces the amount of navigating you have to do when following the codepaths for your networking logic.
Also, if you've effectively written a wrapper against an API in ASI, you may want to consider subclassing AFHTTPClient and implementing common logic in such a subclass.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have been poking around with the Twitter framework for a bit and I'm wondering, is there an easy way to retrieve the lastest tweet from a user instead of a ton at once?
Thanks in advance!
You should use either TWRequest or SLRequest (iOS 6+). First you have to get your twitter account with ACAccount. Here's a example.
And then, you have to perform a request to the twitter API to get the last tweets. You can set the cardinality, as many other things trough the different params you will find her.
The request can be performed either with TWRequest (deprecated in iOS 6) or with SLRequest (introduced in iOS 6). Here an example of how to determine which one to use.
You have to remember to link the frameworks.