I am trying to replace my NSMutableURLRequest
with an ASIHTTPRequest
, I have tried the following below, but when I try this my app crashes. I get no errors just a warning:
Incompatible pointer types sending 'ASIHTTPRequest *' to parameter of type 'NSURLRequest *'
How do I fix this, what I tried is below and I have commented out what I was replacing:
receivedData = [[NSMutableData alloc]init];
//NSURL *JSONURL = [NSURL URLWithString:url];
NSURL *url = [NSURL URLWithString:url];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setUseSessionPersistence:YES];
[request setUseKeychainPersistence:NO];
[request setUsername:@"username"];
[request setPassword:@"password"];
[request setDomain:@"domain"];
[request startSynchronous];
//NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:JSONURL];
jobsConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[jobsConnection start];
extra code:
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
[receivedData appendData:data];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
//NSLog(@"%@" , error);
communityDictionary = nil;
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *myError;
if([connection isEqual:jobsConnection])
{
communityDictionary = [[NSDictionary alloc]initWithDictionary:
[NSJSONSerialization JSONObjectWithData:receivedData options:kNilOptions error:&myError]];
}
}