मैं एक HTTP अनुरोध करने और स्टिग की JSON लाइब्रेरी का उपयोग कर JSON का विश्लेषण करने की कोशिश कर रहा हूं। स्वत: संदर्भ गिनती मोड में उपलब्ध नहींत्रुटि 'autorelease' अनुपलब्ध है: स्वचालित संदर्भ गिनती मोड में उपलब्ध नहीं है
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];
अद्यतन
रुचि किसी के लिए, यह सही कोड है जब मैं इस कोड का उपयोग: मैं इस त्रुटि 'autorelease' हो रही है अनुपलब्ध है : NSURLRequest * request2; request2 = [NSURLRequest requestWithURL: [NSURL URLWithString: [NSString stringWithFormat: @ "http://sandbox.CompanyName.com/api/%@/users/%@/user_badges?url=CompanyName.map2.com&amount=999999999999", [info stringForKey: @ "apiKey"], [info 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];
स्वचालित संदर्भ गणना के परिचय के साथ आईओएस 5 में मेमोरी प्रबंधन में बहुत कुछ बदल गया है। आपको एआरसी के लिए एक अच्छा परिचय पढ़ने की जरूरत है। मैं सलाह देता हूं [रे वेंडरलिच के ट्यूटोरियल] (http://www.raywenderlich.com/5677/beginning-arc-in-ios-5-part-1) Matthijs Hollemans द्वारा। – Thilo