Using Remote Web Page to Initialize iPhone App - ios

My iPhone app relies on a vendor's XML feed to provide data. But that feed is not locked down. The vendor could change the format of the XML at any time, although so far they've promised not to.
Since I might want to tell my app to use a different URL for its data source, I'd like to set up a single "Command Central" Web page, on my own server, to direct the app to the correct data source.
In other words, each time my app starts, in the background and unseen by the user, it would visit "http://www.myserver.com/iphoneapp_data_sources.xml" to retrieve the URL for retrieving data from my vendor. That way, if my vendor suddenly changes the exact URL or the XML feed that the app needs, I can update that Web page and ensure that all installations of the app are using the correct XML feed.
Does anyone have any advice or examples showing this kind of approach? It seems as if this must be a common problem, but so far I haven't found a well-established design pattern that fits it.

Instead of connecting your iPhone app directly to the vendor's XML feed, you could use a page on your own server as a proxy.
The iPhone app connects with http://www.yourserver.com/proxyxmlfeed.xml, which redirects to the correct vendor URL, http://www.vendorsserver.com/realxmlfeed.xml. This way, if for some reason the real XML feed URL changes, you only have to change the URL the proxyxmlfeed.xml file redirects to, and you're done!

Related

Keeping users in sync with each other in an social network app?

I am wondering about what the best way to keep users in sync with each other in a social network is. The concerned stack is an iOS app with a NodeJS backend. Let me give you an example:
Say X and Y are friends on a social network. Y's posts appear in X's feed, and as such, Y is cached somewhere on the X's phone. This morning, Y decided to change profile pictures however. Everything is well, the new picture is uploaded to the server, but how do we go about letting X know about the change of profile picture?
My possible solution: Create a route /<UID>/updates that contains a stack of "cookies" which lets the user know what and who changed since the last time they made a GET request to the route.
This seems elegant enough, but what worries me is what happens on the client side (am I supposed to make a GET request every 2 minutes during my app's uptime?). Are there any other solutions?
One solution is indeed to poll the server, but that's not very elegant. A better way is to make use of websockets:
WebSockets is an advanced technology that makes it possible to open an interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.
They are a 2-way connection between client and server, allowing the server to notify the client of any changes. This is the underlying technology used in the Meteor framework for example.
Take a look at this blogpost for an example of how to use websockets between an iOS client and a NodeJS backend. They make use of the open source SocketRocket iOS library.

Is it possible to update only part of an app in the App Store?

My app relies on an external service that might change its output any time without warning, so I would need a completly new function to parse it. Is there anyway to update my service parser without having to re-submit the whole app for review? Otherwise part of my app would be broken during the time to develop and review the new parser. I was told I cannot use bundles for this, so I really am clueless how to solve this problem.
You can't solve that problem completely on the client side.
Depending on the output format of the external service, and the methods you use to parse its output, you might have the option to store a file in a server that contains information about the current output format of the external service. Then your app can use the meta-data in that file to determine how to do the parsing.
You can also develop a simple web service that wraps the external service. Then your app can use the web service instead of the original service, and whenever the output of the original service is changed, you can quickly update your web service to make your app continue functioning properly.

Little Snitch reports my app (when run in simulator) wants to connect to random websites

I have an app that uses a web service to get data. I hit one site for the data, passing in various parameters/methods depending on what data I need. The base URL of the site is always the same. I'm using AFNetworking whenever I get/receive data.
When I launch my app in the iOS simulator, Little Snitch indicates that my app wants to connect to a couple of sites - sites that are not in my code!
Example sites Little Snitch has indicated:
www.tv.com
common.publicradio.org
Anyone know why this happens?
EDIT:
I'm only hitting some Cold Fusion methods at http://www.acquisign.com no other sites. The Acquisign site has no links to any of the mentioned sites. I load no web pages, just get JSON back from the CF methods invoked at the Acquisign site.
EDIT 2:
More info:
I've fond that this has to do with OpenDNS. If I set my network to not use OpenDNS, I don't get these random connection warnings from Little Snitch and my app. (Today it wanted to connect to home depot.com and relish.com).
OpenDNS is most likely responding to a non-loading page request with a page of link suggestions. I now wonder what the non-loading page is - as I only hit one site and get JSON back and the JSON contains no other URLS....

Access documents on secure web server

I'm trying to build an iPad app to download and display documents (pdf, ppt, doc, etc.) from a web server.
Currently it does this by parsing the HTML structure (using hpple) on the server.
For example, the files are held at:
Http://myserver.com/myFolders/myFiles/
The app goes to this location and traverses the tree, using an X-Path query, e.g.
"/html/body/ul/li/a"
It then downloads whatever documents it finds to the iPad for display.
So far this works quite well but the server is publicly accessable.
My question is, how would I go about doing something similar with a secure server?
e.g. is it possible to password protect the server, connect to it with username/password from the iPad and use the same system?
In the end I decided not to parse the HTML as there seemed to be no straightforward way to do so. Instead the documents are held on an ASP.Net server with authentication required for access.
It would've been nice to know how to do so by traversing HTML but no biggie.

taking a screenshot of user's current page in ruby on rails

this is fo debugging purpose, please take into account the following:
the user logs in to his/her account so manually fetching a url will not work - the screenshot must happen together when the user access his admin pages.
would love to receive guidelines specific for ruby on rails and heroku (i guess heroku is not much an issue i just dump the screenshot to s3).
so ideally like i mentioned in #1, when a user access a page, my app also takes a screenshot of the entire page and dumps it in a tmp folder.
can anyone point me how to handle that?
In order to get a screenshot of what the user is currently seeing, you have to have some code on the user's machine that uses the underlying operating system API to take the screenshot. The API calls involved are different for Windows, Mac OS X and Linux.
Ruby on Rails executes on the remote server and generates HTML and JavaScript etc. that is sent to the user's web browser. The HTML is rendered by the browser and the JavaScript executes within the browser's sandbox, where it has no direct access to the operating system API. The important point is that there is no direct interaction between the server-side code and the OS running on the user's computer. If this were possible then it would be a massive security hole.
Therefore it's not possible to do what you want programmatically unless you can first install a client-side program on the user's computer that can talk to your server-side code. It cannot be done using Ruby on Rails alone because it's a server-side web framework.
You can't do this without a user sending a screenshot themselves.

Resources