I am only just starting out with iPhone application development and have been doing some research with regards at getting data into an app using information available via the web.
I understand that I can access web pages using the NSURL* classes. Does anyone know how I might request data from a page that requires user input?
I can understand accessing an actual page, but I am not sure if (or how) I might be able to initiate the request and get the appropriate data back into my app.
Any help / pointers is very much appreciated.
EDIT_001:
I was thinking that I would have to interact with the actual controls on the page, but after a little more investigation I have found that I can simply use the request HTML that the page generates.
gary
This question is really too broad ("how does http networking work"), and if you look around this site you will probably find several questions that will take you in the right direction. As a first stop, check out the ASIHTTPRequest framework. Many people use it, and it makes http networking really simple.
You could also have a look at these links for inspiration:
http://iphoneonrails.com/
http://metaskills.net/2010/2/12/synchronizing-core-data-with-rails-3-0-0-pre
Related
I'm not a developer but an internet marketer - so forgive me for what is I'm sure a very basic question. In my career, it's useful when looking at website marketing to better understand what tools are used, such as Google Analytics for example. Most of the time this is quite simple - just view source and you'll see in the source code the javascript snippet.
I use the ghostery plugin to make this a bit easier, but what I don't understand about http requests is how ghostery reports a technology as being used, such as the ad server DoubleClick for example, but I can't see any code in the source code that references Doubleclick. This happens a lot but it's most often with ad server technologies.
When I look using Chrome Dev Tools, I do in fact see that the call was made by viewing the Source tab.
My question is this and it's really a general question where I'm trying to better understand how calls are made back and forth between the browser and all the various servers and services:
How, in Chrome Tools do I find what code made the call to load the resource, such as DoubleClick. I can't find anything in the source code, which tells me I don't fully understand how interactions are working.
I think from search StackOverflow that is is a xmlhttp call but I'm not sure about that, maybe it's cookies - I just don't know how this is working. At the end of the day, I don't like not understanding how this all works, so I'm hoping someone can point me in the write direction.
Thanks.
In the Network panel, find your request of interest. The Initiator column will contain a reference to the code that has initiated loading the associated resource.
I am having a problem here. I am totally new to this concept of servers and web services and being able to get data uploaded and retrieved on different devices, but I want to learn it, say if I want to create an app like Instagram.
But that is EXACTLY what I dont want, a link to a long tutorial on the internet on how to create the most complex app ever, I want to start slow. After doing extensive power searches on Amazon there are basically no books that will help me. So I want to start slow, here is my goal:
Get a great understanding of how web service backends and servers work and be able to apply it in other app ideas I have and want to start developing
I would like to start by being able to create an app that allows a user to enter some text into a field, it uploads to the server, another device can press a button to retrieve the text and display it in a text view.
I do not know php, and every single tutorial I have entered on this website is literal mindeff, the reason for this is because everyone has a different solution, sync web service backend with Core Data, MySQL, parse, Rails and it truly overwhelms me because I do not know which one to pick! And even worse some people provide code but I have no understanding whatsoever, and its like looking at a totally new language!
I am not asking for code, in fact that is the exact opposite. I am asking for someone to really lay out their knowledge, how does it all work? What is the best tool? Some resources and links. Nothing too complex...
I hope you can truly understand my extreme confusion and frustration. I think the reason might be is I might not be ready yet for all this, but I want to push forward and carry out my app idea!
Thank you...
Update:
I have finally decided on a web service I would like to use, it is the Amazon S3 web service, I am still not fully comprehending the full process though, any help or ideas!?
Since you wanted to create an Instagram-type app, look at this: http://www.raywenderlich.com/13511/how-to-create-an-app-like-instagram-with-a-web-service-backend-part-12
This is a good link to servers: http://www.youtube.com/playlist?list=PLC71D7CFB6AF935E6&feature=plcp. Watch the list to get an understanding of servers.
Maybe you want to read up on sql. Understanding sql will help.. Again: http://www.youtube.com/course?list=EC32BC9C878BA72085&feature=plcp. Watch the list to get an understanding of sql...
I can pass you the link and you got to do the work....
Hope this helps...
So I am working on an iPad app that needs to talk to our company server to pull in some XML. In a browser, when the user tries to first navigate to the site, they are redirected to an SSO form that generates a cookie that is saved.
Now my application may need to replicate this behavior and generate the cookie so we can pull xml data off various parts of the site. I have never done anything like this before and there is very little documentation on the web so I am really looking for some general guidance. So far I have tried doing something like this, here.
That works to return the web form, but where to go from there eludes me. Does anyone have any ideas they would like to throw out? Essentially all that I need to do right now is authenticate the user's credentials, and save that verification. If there is an easier way to do that based on this template, I would definitely be open to suggestions. Any help at all would be greatly appreciated.
What i use for a lot of my networking is ASIHTTPRequest it is an API that is available, instead of trying to use low level sockets or the Apple APIs, with a decent guide and an active Google Group for questions. It can certainly handle xml requests as well as authentication. Here is a link to the site, ASIHTTPRequest
Would like to ask for recommendation for ways that I can build application in cocoa to simulate user submission. For example, filling in registering form or even simulate a click in the web form. Not sure what exactly is the term for this.
Tried to google around, but didn't find any result. Closest I get is webkit, but not sure how to apply it and i thought it is only for web rendering.
Highly appreciated if someone could share some thoughts.
In short, you'll want to construct an HTTP POST with the appropriate form values in the body of the post.
You can use NSURLRequest or NSMutableURLRequest to construct the request.
Docs are at: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html
or you can use something a bit higher level - I'm liking ASIHTTPRequest a lot right now.
http://allseeing-i.com/ASIHTTPRequest/
I have an app that creates a couple of WebView instances and I'd like to have them operate as independently as possible.
At the very least, I don't want them sharing cookies. A quick google search gave me results liking "you can't." I'm hoping someone has a better answer.
The basic answer is "you can't".
After looking at this for a bit, I think it's possible, but extremely complicated. It would involve implementing a resourceLoadDelegate on your WebView that implements -webView:resource:willSendRequest:redirectResponse:fromDataSource: and modifies the request to turn off HTTPShouldHandleCookies and adds any relevant cookies to the request manually. It also has to implement -webView:resource:didReceiveResponse:fromDataSource: to find out about any cookies returned from the server. You can alloc/init your own copy of NSHTTPCookieStorage per-webview and use that to store/retrieve the cookies.
This post sums up what you could do. I'm not sure if it is feasible for you and I feel it wouldn't be a straightforward task, maybe even risky, but it seems to be possible: the author claims iCab does it this way.
I was hoping for a simpler solution too, really. Of course, since Webkit is open source you could just roll out your own version of the framework with changed behavior I guess?
I would assume that cookies would be configured on a service / application level and not for particular instances or processes. Perhaps you could revise your question to find a way to resolve the problem you are having which requires that the instances do not share cookies.
What is the motivation for not sharing cookies between the instances?
If you just need 3 views into the same web resource you could setup some virtual hosts that point to the same data source.
What you can do is take a look at libcurl which can handle cookie stores that don't mix with the URL Loading system wide cookie storage for those requests you want to separate. For me that seems to be a valid and simple solution. If you really need to depend on webview/webkit it might not be.