Basically, how can I store data in a URL that can be accessed by other devices?
This would be similar to how Instagram works, where people can see the pictures that others post, even though the files are not stored locally on the user's device.
This could also be a way to create high score leaderboards in a game without using GameCenter.
Thanks in advance.
NSURLRequest class is better to use to perform request by URL. So, if you have some RESTful backend by the URL that accept POST data you will be able to push binaries. You can find code iOS example for request similar to yours by following URL - Send image to server as binary data
For the server side I would suggest to take a look into node.js direction (http://nodejs.org)
You need some form of server support, like php, asp etc.
Have a look at HTTP POST and for iOS have a look at NSURLConnection Class Reference, or even better, AFNetworking.
Related
Can any one please guide me on this . I am new to iphone/ipad programming.I store videos on my webserver (apache/php).I need to write code for an ipad app to get the videos list for a selected user and play those videos on the ipad/iphone using a php webservice.I was not able to get going on this.Please can anybody share any related links or shower your thoughts on this ? Any help would be highly appreciated.
Thanks
your question actually involves a lot to implement, but I'm not sure where you're right now:
Sever-side programming to expose web-service which can be invoked to
get a list of available videos. Have you done this? And what format
your server-side responses, SOAP XML or JSON?
From your iOS client side, you firstly need to establish an HTTP
request to the web-service URL entry. Have you done that? You may
want to use ASIHTTPRequest to save your effort.
Once you've got server response, depending on how the data is
presented, you may need to find a XML parser or a JSON parser to
parse the raw response.
Then you need to either download the video entirely before playback,
or stream the playback. You may again need ASIHTTPRequest for
downloading. You may need MPMoviePlayerViewController or
MPMoviePlayerController(if you want more control over the player layout) to plackback/stream the video, see:
MPMoviePlayerController and HTTP Live Streaming
And don't forget to save the playlist and user viewing history if
you want to provide a smooth user experience. You may use as simple
as NSUserDefaults/plist as the data persistence media, or as complex
as SQLite database or Core Data.
I suggest you to break down your ultimate goal into specific tasks, and tackle them one by one.
Program your web server to return a JSON object with the list of
movies. You can include preview thumbnails etc.
Include one of the JSON frameworks available (just do a quick
search, there are plenty).
Use the data from the JSON feed to display your list.
When the user clicks on an item, launch a view controller with a
UIWebView to display your movies.
If you do not know how to do any of these things, you should consider an objective-C programming tutorial first.
I'm writing a very simple iPhone app, basically a dropbox where people can submit ideas and then view what's in the dropbox. I need to write a server that will respond to my iPhone's (HTTP?) requests. Are there any good tutorials on the web that will show me how to do this? Thanks.
Well it really depends on what kind of platform are you trying to write your server.
If it's going to be linux, apache, mysql and PHP (LAPM) then probably this question would answer some of your questions: Serving a json file for IPHONE app
Also this one might be helpful: http://www.sencha.com/learn/Tutorial:Creating_JSON_Data_in_PHP
You could server your data in various formats: binary, XML, JSON, etc. However if I were you i would definitely choose JSON ...
You also can use ruby, .net or anything else for building your web server, however probably php is going to be the one with the most examples.
Hope this helps.
For communicating with the server take a look at ASIHttpRequest, which has some good documentation and example code included http://allseeing-i.com/ASIHTTPRequest/How-to-use
i recomment using the ASIHttpRequest Classes.
On the serverside just use a simple JSON API and probably oAuth or HTTP Authentication to submit and receive Data from a Database.
My question deals delivering information to iPhone devices via an online DB. (Essentially, I want to do something like the NYTimes App, which provides the latest news for each device containing the app). I know I need to use a SQL lite database to accomplish this. What is the best way to approach this problem? I am a newbie at this stuff, so I'm not sure exactly where to get started? Do I need to create an online DB, or can I update outstanding apps from a local SQL database?
Thanks in advance!
Vineet
For connecting to remote databases for getting data you will have to send request from iphone either in XML or JSON format.
If you are using XML, then use NSXMLParser for parsing the XML file sent as response from the remote application. Better option would be to go for JSON.
You need to create a web application which should return a data to iPhone over http protocol.
I think I've done something similar a while ago.
I created a simple PHP API which returns the posts from a blog in JSON form. Then in the iPhone app I make an API request, parse the resulting JSON string and setup a UITableView with the stuff I retrieved from the database. In this way you don't query the database directly, it's the PHP script that does it.
You could also use XML instead of JSON, of course. If you end up using JSON, you can use this library to parse it in your app.
I am new to iPhone programming and would like to be able to use the BLAST (is a bioinformatics server) URL's API from the iPhone. I would like to write a very simple application that queries the BLAST server and make some query. I have found the following
I have found the following documentation on BLAST (http://www.ncbi.nlm.nih.gov/BLAST/Doc/urlapi.pdf).
I am not sure from where I should start.. I checked out the following on security concepts for Mac OS X and iOS(http://developer.apple.com/iphone/library/documentation/Security/Conceptual/Security_Overview/Concepts/Concepts.html) and then found CFNetwork library (http://developer.apple.com/iphone/library/documentation/Networking/Conceptual/CFNetwork/Introduction/Introduction.html).
But I don't really know from where to start..
theoretically I would like to query the BLAST url API from a .mm class method (so I can use standard C) and then show the results in a normal view.
Anyone would be able to guide me in these first steps?
Best regards and Many thanks!
The BLAST API is strange. It is a POST-only command-response API, but the commands you POST are things like CMD=Get&..., CMD=Put&..., etc.
The iPhone SDK provides a fairly convenient high level way to invoke URLs. Have a good read of the NSURLRequest documentation. You'll need to set the HTTPMethod property to POST, and populate the HTTPBody with whatever the BLAST API tells you to post.
I'd like to build in some weather functionality into my app and I'm going to be using the NOAA weather web service to retrieve the weather information. The NOAA website has a great deal of information on how the data should be requested and how the resulting data is structured. I'm new to iOS development, so I just need a little direction because I'm not sure which APIs I should be using to request and process this data. My questions are...
What's the proper way to request access to the user's location?
If the user allows access to their location, which APIs would I use to access it?
To make an HTTP request to the RESTful webservice, which APIs should I use?
To process/parse the resulting XML data, which API's should I use?
And if anyone can suggest any good examples online that demonstrate any of this functionality, that would also be helpful.
Thanks so much so much in advance for your wisdom!
For location data, look into CoreLocation
http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CoreLocation_Framework/index.html
For HTTP requests I like to use the ASIHTTPRequest class
http://allseeing-i.com/ASIHTTPRequest/
TouchXML makes it easy to work with XML data
http://code.google.com/p/touchcode/wiki/TouchXML
Just today, Luke Redpath posted a complete iPhone REST client he wrote. I can't vouch for it, I only saw today that it even exists. But Luke does good work, so I assume it's pretty decent.
See here:
http://lukeredpath.co.uk/blog/some-code-that-i-wrote.html