Discuss Need help in coding: NSURLRequest Example at the Free Toolchain Software (Cydia App's) - Hackint0sh.org; I am creating an iPhone app with limited knowledge of Objective-C (but am learning a ...
Need help in coding: NSURLRequest Example
I am creating an iPhone app with limited knowledge of Objective-C (but am learning a lot along the way and have figured out how to do a lot of the UI stuff, alert sheets, button clicks, etc).
I now need my app to go to the internet, fetch a page of text, and convert it to a string (presumably using NSURLRequest). I know that there is the mobile-rss app out there, and I have looked at the code and do not understand it and feel that it is more complicated than I need.
I am hoping that someone can provide me with some sample code for my needs (just fetching an HTML request and giving me the request as an NSString).
Thanks in advance,
All NS* classes are normal Cocoa classes, which means documentation is available at developer.apple.com.
There's details and some sample code fragments at:
I have done some more digging, and actually got some code to work (for a bit).
It did work for a while, and then I started working on the next bit of code. Then, it started crashing when it got to the above code (when I was running the app), so I removed all references to the new code that I had just made, but still got the error, which is:
NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:FeedURL]];
NSURLResponse *resp = nil;
NSError *err = nil;
NSData *response = [NSURLConnection sendSynchronousRequest: theRequest returningResponse: &resp error: &err];
NSString * theString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
NSLog(@"response: %@", theString);
I can find almost no references to _mustRevalidate online. Does anyone have any ideas?
2007-12-19 21:48:10.589 App[190:3103] *** -[NSConcreteMutableData _mustRevalidate]: selector not recognized [self = 0x1b02a0]
2007-12-19 21:48:10.593 App[190:3103] *** Uncaught exception: <NSInvalidArgumentException> *** -[NSConcreteMutableData _mustRevalidate]: selector not recognized [self = 0x1b02a0]
zsh: trace trap ./App
Your error is that _mustRevalidate is being called on something that doesn't recognize it. Since you're not doing the calling, you're letting the wrong object end up in the wrong place, or it's a OS bug. Since we're fairly certain NSURLConnection stuff works, I'm betting it's not an OS bug.
For starters, remove both release statements. You didn't allocate or retain the object, so don't release it. Tell me if that fixes it.
By sabtuzdeamon in forum Kernel / Kext (Driver) Support
Last Post: 01-11-2011, 05:35 PM
By homer3g in forum iPhone Developer Exchange
Last Post: 11-13-2008, 06:37 PM
By alexfunari in forum iPhone Developer Exchange
Last Post: 10-17-2008, 02:05 AM
By Nuttynutter123 in forum General
Last Post: 01-06-2008, 02:29 PM