좀비를 나타내는이 오류가 계속 발생합니다. 나는이 두 가지 방법으로 그 범위를 좁혔지만, 나 자신의 삶은 잘못된 것을 알아낼 수 없다.[CFDictionary release] : 할당 취소 된 인스턴스로 전송 된 메시지, 무엇이 잘못 되었나요?
아이디어가 있으십니까?
-(void) getWeatherDetail: (NSString *)query
{
@try
{
NSString *urlString111 = [NSString stringWithFormat:@"http://www.google.com/ig/api?weather=%@",query];
urlString111 = [urlString111 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:urlString111];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSData *returnData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil];
if(xmlParser)
{
xmlParser=nil;
[xmlParser release];
}
xmlParser = [[NSXMLParser alloc] initWithData: returnData];
isForeCast = NO;
isFirstForeCastEnd = NO;
if (!self.arrForecastAll) {
self.arrForecastAll = [[NSMutableArray alloc] init];
}
[self.arrForecastAll removeAllObjects];
[xmlParser setDelegate: self];
[xmlParser setShouldResolveExternalEntities: YES];
[xmlParser parse];
// self.logString = [NSString stringWithFormat:@"%@Date & Time: %@ | Text: Getting Weather detail.\n", self.logString, [NSDate date]];
// [self updateLogFile:self.logString];
}
@catch (NSException *exception) {
NSLog(@"Ad exc %@",[exception description]);
}
@finally {
}
}
그리고이 하나
..-(void)getCurrentCityName
{
//////Method to find current city name
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@try
{
if ([self.arrSettings count] > 0 && [[[self.arrSettings objectAtIndex:3] objectForKey:@"Value"] isEqualToString:@"Current Location"])
{
if (currentlat != 0 && currentlong != 0) {
NSURL *urlString;
NSLog(@"lat %f %f" ,currentlat,currentlong);
urlString =[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps/geo?output=json&oe=utf-8&ll=%f,%f&key=[removed API key]",currentlat,currentlong]];
NSLog(@"\n\n-------------------------TF-Get City Name -Request-----------------------------\n%@\n\n",urlString);
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ;
[request setURL:urlString];
NSData *returnData = [ NSURLConnection sendSynchronousRequest: request returningResponse:nil error: nil ];
NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
NSLog(@"\n\n------------------------TF-Get City Name -Response------------------------\n\n%@\n\n",returnString);
[request release];
NSDictionary *dictAddress=[returnString objectFromJSONString];
NSLog(@"dictAddress %@",[dictAddress description]);
[returnString release];
NSString *strCity = [NSString stringWithFormat:@"Getting Location"];
NSLog(@"strCity %@",strCity);
if ([[dictAddress allKeys] count] > 1)
{
if ([[[[[[dictAddress valueForKey:@"Placemark"] objectAtIndex:0] valueForKey:@"AddressDetails"] valueForKey:@"Country"] valueForKey:@"AdministrativeArea"] valueForKey:@"SubAdministrativeArea"])
{
strCity = [NSString stringWithFormat:@"%@,%@",
[[[[[[[[dictAddress valueForKey:@"Placemark"] objectAtIndex:0] valueForKey:@"AddressDetails"] valueForKey:@"Country"] valueForKey:@"AdministrativeArea"] valueForKey:@"SubAdministrativeArea"] valueForKey:@"Locality"] valueForKey:@"LocalityName"],
[[[[[[dictAddress valueForKey:@"Placemark"] objectAtIndex:0] valueForKey:@"AddressDetails"] valueForKey:@"Country"] valueForKey:@"AdministrativeArea"] valueForKey:@"AdministrativeAreaName"]];
}
else {
strCity = [NSString stringWithFormat:@"%@,%@",
[[[[[[[dictAddress valueForKey:@"Placemark"] objectAtIndex:0] valueForKey:@"AddressDetails"] valueForKey:@"Country"] valueForKey:@"AdministrativeArea"] valueForKey:@"Locality"] valueForKey:@"LocalityName"],
[[[[[[dictAddress valueForKey:@"Placemark"] objectAtIndex:0] valueForKey:@"AddressDetails"] valueForKey:@"Country"] valueForKey:@"AdministrativeArea"] valueForKey:@"AdministrativeAreaName"]];
}
self.strCurrentCity = strCity;
[self getWeatherDetail:self.strCurrentCity];
}
}
else
{
self.strCurrentCity = @"Current Location";
}
}
else
{
self.strCurrentCity = [[self.arrSettings objectAtIndex:3] objectForKey:@"Value"];
[self getWeatherDetail:self.strCurrentCity];
}
// self.logString = [NSString stringWithFormat:@"%@Date & Time: %@ | Text: Getting current city name. CityName: %@\n", self.logString, [NSDate date], self.strCurrentCity];
// [self updateLogFile:self.logString];
[pool release];
}
@catch (NSException *exception) {
NSLog(@"Ad exc %@",[exception description]);
}
@finally {
}
}
어떤 라인이 충돌합니까? –
당신은'objectFromJSONString' 메쏘드의 구현을 게시 할 수 있습니다 ... 그리고 incarna는 한 줄짜리 코딩 스타일을 피하기 때문에 읽기가 어렵습니다. 네가 부셔 버릴 수 있다면 .. –