Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arme

macrumors member
Original poster
Sep 15, 2008
48
0
i want receive string from url. i can receive a html but i don't want to load html . how?
 
NSURLConnection and NSURLRequest are what you want. I use these to download the source code for web pages which I then parse.
 
i need connect to url for receive information login. for example check user and pass
 
Iphone Programs returns to home screen automaticcaly

Hi All

I am new to Iphone Development and Objective C.I had made an application in which i get the users lat long as soon as he open my location. And on the basis of their lat long I have to perform various thing.My Program is running fine on the Iphone Simulator 2.1. But when I tried to run it on the real device its always bring me back to the home screen of my application.

I am looking forward to hear from you people. Please do reply as i already waisted enough no of days on this issue.

Thanks in advance.
Amit
 
can you help me that use which function NSURLRequest that receive a string from url
 
i need connect to url for receive information login. for example check user and pass

I'm afraid that I can't understand what you want to do, probably because English is not your first language. Can you please outline what you are doing clearly and simply. You would use NSURLConnection to download data from a URL source. If you are trying to login to a website via a login form or similar this could, potentially, be done use NSURLConnection and a NSMutableURLRequest in which you would set the headers to correspond to a form POST.

All of this is covered in the documentation which I suggest you read. You can read about the URL loading system here.
 
NSURLConnection and NSURLRequest are what you want. I use these to download the source code for web pages which I then parse.

Question...what are you using to parse the webpages you are downloading? I've been looking all over for an html parser. Is one needed for this? Or are you just writing your own parse code?

I ask because I'm trying to find a nice and effective way to grab certain bits and pieces out of a page.

Thanks!
 
NSURLConnection and NSURLRequest are what you want. I use these to download the source code for web pages which I then parse.

I have previously posted about this and was wondering if anyone could provide me with some coding examples? I have an RSS feed and I want the link to the full story to open up in my inbuilt web browser, but I don't know how to do this using NSURL as I am new to Objective c.
 
The main thing you need to do is set a delegate for your web view. Something like webView.delegate = self;

Then you can add this to do something with the URL:
Code:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
	if (navigationType == UIWebViewNavigationTypeLinkClicked) {
		// do something with request.URL
		return NO;
	}
	return YES;
}
 
Question...what are you using to parse the webpages you are downloading? I've been looking all over for an html parser. Is one needed for this? Or are you just writing your own parse code?

I ask because I'm trying to find a nice and effective way to grab certain bits and pieces out of a page.

Thanks!


I do it all by hand: there is no generic HTML parser. If you can 100% guarantee that the document is valid XML you can use the available XML parser, otherwise you are on your own. I just use a combination of substrings/splits on characters to get what I want from the document.
 
So would you replace:

--------------------
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:storyLink]];
--------------------

With:

--------------------
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
// do something with request.URL
return NO;
}
return YES;
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.