ASIHttpRequest problems. "unrecognized selector sent to instance"

Posted by Paul Peelen on Stack Overflow See other posts from Stack Overflow or by Paul Peelen
Published on 2010-04-11T19:03:16Z Indexed on 2010/04/11 21:53 UTC
Read the original article Hit count: 447

Hi,

I am experiencing problems using ASIHttpRequst. This is the error I get:

2010-04-11 20:47:08.176 citybikesPlus[5885:207] *** -[CALayer rackDone:]: unrecognized selector sent to instance 0x464a890
2010-04-11 20:47:08.176 citybikesPlus[5885:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[CALayer rackDone:]: unrecognized selector sent to instance 0x464a890'
2010-04-11 20:47:08.176 citybikesPlus[5885:207] Stack: (
    33936475,
    2546353417,
    34318395,
    33887862,
    33740482,
    126399,
    445238,
    33720545,
    33717320,
    40085013,
    40085210,
    3108783,
    11168,
    11022
)

And this is my code (Part of it):

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{

 [image setImage:[UIImage imageNamed:@"bullet_rack.png"]];

 BikeAnnotation *bike = [[annotationView annotation] retain];

 bike._sub = @"";

    [super viewDidLoad];

 NSString *newUrl = [[NSString alloc] initWithFormat:rackUrl, bike._id];
 NSString *fetchUrl = [newUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

 [networkQueue cancelAllOperations];
 [networkQueue setRequestDidFinishSelector:@selector(rackDone:)];
 [networkQueue setRequestDidFailSelector:@selector(processFailed:)];
 [networkQueue setDelegate:self];

 ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:fetchUrl]] retain];
 [request setDefaultResponseEncoding:NSUTF8StringEncoding];
 [networkQueue addOperation:request];

 [networkQueue go];
}

- (void)rackDone:(ASIHTTPRequest *)request
{
 NSString *resultSearch = [request responseString];

 NSData *data = [resultSearch dataUsingEncoding:NSUTF8StringEncoding];

 NSString *errorDesc = nil;
 NSPropertyListFormat format;
 NSDictionary * dict = (NSDictionary*)[NSPropertyListSerialization
            propertyListFromData:data
            mutabilityOption:NSPropertyListMutableContainersAndLeaves
            format:&format
            errorDescription:&errorDesc];

 rackXmlResult* fileResult = [[[rackXmlResult alloc] initWithDictionary:dict] autorelease];
 rackXmlSet *rackSet = [fileResult getRackResult];

 NSString *subString = [[NSString alloc] initWithFormat:@"Cyklar tillgängligt: %@ -- Lediga platser: %@", rackSet._ready_bikes, rackSet._empty_locks];

 [activity setHidden:YES];
 [image setHidden:NO];

 BikeAnnotation *bike = [annotationView annotation];

 bike._sub = subString;
}

- (void) processFailed:(ASIHTTPRequest *)request
{
 UIAlertView *errorView;

 NSError *error = [request error];
 NSString *errorString = [error localizedDescription];

 errorView = [[UIAlertView alloc]
     initWithTitle: NSLocalizedString(@"Network error", @"Network error")
     message: errorString
     delegate: self
     cancelButtonTitle: NSLocalizedString(@"Close", @"Network error") otherButtonTitles: nil];

 [errorView show];
 [errorView autorelease];
}

The process is loaded as LeftCalloutView in the callout bubble when annotations are loaded in my mapview, so quite a lot (80 times or so). It is meant to retrieve a XML Plist from a server, parse it and use the data... but it dies at the rackDone:

Does anybody have any ideas?

Regards, Paul Peelen

© Stack Overflow or respective owner

Related posts about iphone

Related posts about asihttprequest