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

freakmoister

macrumors newbie
Original poster
Dec 2, 2011
3
0
Hi Everyone

I'm trying to implement a http connection delegate but I keep running into this error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'

It happens when it calls the line starting with "NSURLConnection alloc...."

Can anyone give me a pointer as to what I'm missing?

I call this method from another class with the following lines:

Code:
    NSLog(@"Initing conn....");
    conn = [[httpConn alloc]init]; // conn has property in header --> @property (nonatomic, retain) httpConn *conn;

    
    NSLog(@"requesting reqURL....");
    [conn load:reqURL];


Here's how I implemented the "load" method...

Code:
#import "httpConn.h"

@implementation httpConn
@synthesize responseData;

// code omitted....

- (void)load:(NSString *)myURL
{
    [responseData release];
    responseRCVed = NO;
    NSLog(@"url received: %@",myURL);
    NSURLRequest *request = [[NSURLRequest requestWithURL:[NSURL URLWithString:myURL]
                                             cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
                                         timeoutInterval:60] retain];
        
    if (request) {
        NSLog(@"request is not nil");
        // ---> throws exception when calling the following line
        [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
    }
    [request release];
}

// code omitted...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.