2012-07-10 3 views
0

NSInvocationOperation과 큰 문제가 있습니다. iPod 4, 펌웨어 5.0.1을 실행하면 정상입니다. 하지만 내 iPhone 4, iOS 4.1에서는 충돌이 발생했습니다.잘못된 액세스 충돌이있는 NSInvocationOperation

- (void)updateAnnotation:(id)sender { 
//NSLog(@"UPDATE ANNOTATION ID: %@", self.annoID); 
NSDictionary *senderDic = (NSDictionary *)sender; 
UzooltAppDelegate* appDelegate = (UzooltAppDelegate*) [UIApplication sharedApplication].delegate; 

if ([senderDic objectForKey:@"nb_rejolt"] != nil) { 
    NSInteger new_nb_rejolts = [[senderDic objectForKey:@"nb_rejolt"] intValue]; 
    //if (new_nb_rejolts != rejolts) { 
     //NSLog(@"update nb rejolts: %d", new_nb_rejolts); 

     if (self.rejolts != new_nb_rejolts) { 
      self.rejolts = new_nb_rejolts; 
      //if (self.isGrouped) 
      // [self.masterAnnotation.annotationView performSelectorOnMainThread:@selector(updateAnnotationViewWithRejolts:) withObject:[NSString stringWithFormat:@"%d", rejolts] waitUntilDone:NO]; 
      //else 

      if ([senderDic objectForKey:@"rejolt_fbid"] != nil) { 
       NSString *fbRejoltsString = [senderDic objectForKey:@"rejolt_fbid"]; 
       self.fbRejolts = [[fbRejoltsString componentsSeparatedByString:@","] mutableCopy]; 
       [self.fbRejolts removeLastObject]; 
       [self updateNumberOfRejoltsFromFBFrds]; 
      } 

      [self.annotationView performSelectorOnMainThread:@selector(updateAnnotationViewWithRejolts:) withObject:[NSString stringWithFormat:@"%d", rejolts] waitUntilDone:NO]; 
     } 

     if (self.isGrouped) { 
      if (self.masterAnnotation.isShowingRadius == NO && appDelegate.uMainViewController.isInGroup == NO && (new_nb_rejolts > self.masterAnnotation.rejolts || (new_nb_rejolts == self.masterAnnotation.rejolts && self.getAge < self.masterAnnotation.getAge))) { 
       [self.masterAnnotation removeFromGroupedAnnotations:self]; 
       self.annotationView.hidden = NO; 
       [self.annotationView performSelectorOnMainThread:@selector(showWithAlpha:) withObject:[NSNumber numberWithFloat:annotationAlpha] waitUntilDone:NO]; 
       [[NSNotificationCenter defaultCenter] postNotificationName:@"need_group_annotations" object:nil]; 
      } 
     } 
    //} 
} 

if ([senderDic objectForKey:@"lifetime"] != nil) { 
    float new_lifetime = [[senderDic objectForKey:@"lifetime"] floatValue]*3600; 
    //NSLog(@"new lifetime: %.f", new_lifetime); 
    if (new_lifetime != lifetime) { 
     //NSLog(@"update lifetime"); 
     self.lifetime = new_lifetime; 
    } 
} 

[self updateViewAlpha]; 

if ([senderDic objectForKey:@"radius"] != nil) { 
    float new_radius = [[senderDic objectForKey:@"radius"] floatValue]; 
    if (new_radius != radius) { 
     //NSLog(@"update lifetime"); 
     self.radius = new_radius; 
    } 
} 

/* 
if ([appDelegate.uMainViewController isMaximumZoomIn]) 
    [[self annotationView] performSelectorOnMainThread:@selector(setGroupNumberIndicatorVisible:) withObject:[NSNumber numberWithBool:YES] waitUntilDone:NO]; 
else 
    [[self annotationView] performSelectorOnMainThread:@selector(setGroupNumberIndicatorVisible:) withObject:[NSNumber numberWithBool:NO] waitUntilDone:NO]; 
*/ 

if (isSelected == YES && isShowingRadius == NO) { 
    //NSLog(@"update details"); 
    [self performSelectorOnMainThread:@selector(updateDetailsView) withObject:nil waitUntilDone:NO]; 

    UzooltAppDelegate* appDelegate = (UzooltAppDelegate*) [UIApplication sharedApplication].delegate; 
    if (isGrouped == YES && appDelegate.uMainViewController.isInGroup) { 
     NSLog(@"grouped jolt rejolted"); 
     [self performSelectorOnMainThread:@selector(updateInGroupAnnotationView) withObject:nil waitUntilDone:NO]; 
    } 
} 

가}

내가 어디 잘못 알고하지 않습니다 CustomAnnotation 클래스에

CustomAnnotation *annotation = [[[ModelManager defaultModelManager] getAnnotationDictionaryInMemory] objectForKey:joltId]; 

if (annotation == nil) 
    annotation = [[[ModelManager defaultModelManager] getAnnotationDictionaryInMemory] annotationWithInstagramId:eID]; 

if (annotation == nil) 
    continue; 
//THIS ONE CRASH ON IPHONE 4 OS 4.1 
NSDictionary *param = [[NSDictionary alloc] initWithObjectsAndKeys: @"aKey", @"aValue", nil]; 

NSInvocationOperation *op = [[NSInvocationOperation alloc] initWithTarget:annotation selector:@selector(updateAnnotation:) object:param]; 

[_queue addOperation:op]; 
[op autorelease]; 

updateAnnotation 기능을 정의 :이 내 코드? 도와주세요. 고마워요 !!!

답변

0

NSZombies를 활성화하여 실행 해보십시오. 할당 취소 된 후에 어떤 오브젝트에 액세스하려고하는지에 대한 힌트를 적어도 제공해야합니다.

NSZombies enabled, debug information

+0

내가 NSZombies에 차례 시도했지만 그것은 단지 라인에서 BAD ACCESS를 표시 : NSInvocationOperation * 영업 이익 = [[NSInvocationOperation의 ALLOC] initWithTarget : 주석 선택 : @selector (updateAnnotation :) 객체 : PARAM] ; 내가 할당 해제 된 것을 표시하지 않습니다. –

+0

updateAnnotation 메서드는 어디에 정의되어 있습니까? – jjathman

+0

CustomAnnotation 클래스에 정의되었습니다. –

관련 문제