Fehler "autorelease" ist nicht verfügbar: nicht verfügbar in automatic reference counting " - Modus

Ich versucht, einen HTTP-request zu Parsen von JSON mit Stig ' s JSON-Bibliothek. Ich bin immer dieser Fehler "autorelease" ist nicht verfügbar: nicht verfügbar in automatic reference counting " - Modus, wenn ich diesen code verwenden

NSURLRequest *request2;
request2 = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://sandbox.CompanyName.com/api/%@/users/%@/user_badges?url=CompanyName.map2.com&amount=999999999999",[information stringForKey:@"apiKey"] , [information stringForKey:@"userID"]]]];

NSURLConnection *connection2;
connection2 = [[NSURLConnection alloc] initWithRequest:request2 delegate:self startImmediately:YES];
NSURLResponse *resp2;
NSData *cData2 = [NSURLConnection sendSynchronousRequest:request2 returningResponse:&resp2 error:nil];
NSString *cDataString2 = [[NSString alloc] initWithData:cData2 encoding:NSUTF8StringEncoding];
NSLog(@"getUsersBadges called");
NSError *error4;
SBJSON *json4 = [[SBJSON new] autorelease];
//NSArray *luckyNumbers = [json objectWithString:responseString error:&error];
NSDictionary *luckyNumbers4 = [json4 objectWithString:cDataString2 error:&error4];

[cDataString2 release]; 

UPDATE

Für alle interessierten, das ist der richtige code:
NSURLRequest *request2;
request2 = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://sandbox.CompanyName.com/api/%@/users/%@/user_badges?url=CompanyName.map2.com&amount=999999999999",[Informationen stringForKey:@"apiKey"] , [Informationen stringForKey:@"userID"]]]];

NSURLConnection *connection2;
connection2 = [[NSURLConnection alloc] initWithRequest:request2 delegate:self startImmediately:YES];
NSURLResponse *resp2;
NSData *cData2 = [NSURLConnection sendSynchronousRequest:request2 returningResponse:&resp2 error:nil];
NSString *cDataString2 = [[NSString alloc] initWithData:cData2 encoding:NSUTF8StringEncoding];
NSLog(@"getUsersBadges called");
NSError *error4;
SBJSON *json4 = [SBJSON new];
//NSArray *luckyNumbers = [json objectWithString:responseString error:&error];
NSDictionary *luckyNumbers4 = [json4 objectWithString:cDataString2 error:&error4];

InformationsquelleAutor der Frage Sam Baumgarten | 2011-06-15

Schreibe einen Kommentar