Results 1 to 4 of 4
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 ...
  1. #1
    Newbie Array

    Join Date
    Dec 2007
    Posts
    3
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default 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,
    Jeff



  2. #2
    Senior Professional Array

    Join Date
    Jul 2007
    Posts
    151
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    16

    Default

    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:
    http://developer.apple.com/documenta...ingSystem.html

  3. #3
    Newbie Array

    Join Date
    Dec 2007
    Posts
    3
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    I have done some more digging, and actually got some code to work (for a bit).
    Code:
    NSString *FeedURL=@"http://www.google.com";
    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]; 
    [resp release];
    [err release];
    NSLog(@"response: %@", theString);
    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:
    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
    I can find almost no references to _mustRevalidate online. Does anyone have any ideas?

  4. #4
    Senior Professional Array

    Join Date
    Jul 2007
    Posts
    151
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    16

    Default

    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.

 

 

Similar Threads

  1. Coding...
    By sabtuzdeamon in forum Kernel / Kext (Driver) Support
    Replies: 0
    Last Post: 01-11-2011, 04:35 PM
  2. Internet Radio Coding?
    By homer3g in forum iPhone Developer Exchange
    Replies: 0
    Last Post: 11-13-2008, 05:37 PM
  3. need help with coding the simplest program!
    By alexfunari in forum iPhone Developer Exchange
    Replies: 16
    Last Post: 10-17-2008, 01:05 AM
  4. Coding Help
    By Nuttynutter123 in forum General
    Replies: 0
    Last Post: 01-06-2008, 01:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 07:03 PM.
twitter, follow us!