Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c NSInvocationOperation与坏访问崩溃_Objective C_Memory Management_Nsinvocationoperation - Fatal编程技术网

Objective c NSInvocationOperation与坏访问崩溃

Objective c NSInvocationOperation与坏访问崩溃,objective-c,memory-management,nsinvocationoperation,Objective C,Memory Management,Nsinvocationoperation,我在NSInvocationOperation中遇到了一个大问题。当我在iPod4固件5.0.1上运行时,一切正常。但在我的iPhone4,iOS4.1上,它崩溃了。这是我的代码: CustomAnnotation *annotation = [[[ModelManager defaultModelManager] getAnnotationDictionaryInMemory] objectForKey:joltId]; if (annotation == nil) annotatio

我在
NSInvocationOperation
中遇到了一个大问题。当我在iPod4固件5.0.1上运行时,一切正常。但在我的iPhone4,iOS4.1上,它崩溃了。这是我的代码:

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];
在CustomAnnotation类中定义了updateAnnotation函数:

- (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];
    }
}
-(void)updateAnnotation:(id)发送方{
//NSLog(@“更新注释ID:%@”,self.annoID);
NSDictionary*senderDic=(NSDictionary*)发送方;
UZoolTapDelegate*appDelegate=(UZoolTapDelegate*)[UIApplication sharedApplication]。委托;
if([senderDic objectForKey:@“nb_rejolt”!=nil){
NSInteger new_nb_rejolts=[[senderDic objectForKey:@“nb_rejolt”]intValue];
//如果(新的重新颠簸!=重新颠簸){
//NSLog(@“更新nb更新:%d”,新的nb更新);
如果(self.rejolts!=新的\u nb\u rejolts){
self.rejolts=新的\u nb\u rejolts;
//if(self.isGrouped)
//[self.masterAnnotation.annotationView performSelectorOnMainThread:@selector(updateAnnotationViewWithRejolts:)withObject:[NSString stringWithFormat:@“%d”,rejolts]waitUntilDone:否];
//否则
if([senderDic objectForKey:@“rejolt_fbid”]!=nil){
NSString*fbrejoltstring=[senderDic objectForKey:@“rejolt_fbid”];
self.fbRejolts=[[fbrejoltstring componentsSeparatedByString:@“,“]mutableCopy];
[self.fbRejolts removeLastObject];
[自更新FBFRDS中的Recolts];
}
[self.annotationView performSelectorOnMainThread:@selector(updateAnnotationViewWithRejolts:)with对象:[NSString stringWithFormat:@“%d”,rejolts]waitUntilDone:NO];
}
if(self.isGrouped){
if(self.masterAnnotation.isShowingRadius==NO&&appDelegate.uMainViewController.isInGroup==NO&&(new\u-nb\u-rejolts>self.masterAnnotation.rejolts | |(new\u-nb\u-rejolts==self.masterAnnotation.rejolts&&self.getAge
}


我不知道哪里错了?请帮帮我。谢谢大家

尝试在启用NSZombies的情况下运行。它至少应该给您一个提示,告诉您在解除分配对象后尝试访问哪个对象


我尝试打开NSZombies,但它只在第行显示错误访问:NSInvocationOperation*op=[[NSInvocationOperation alloc]initWithTarget:annotation selector:@selector(updateAnnotation:)object:param];不要告诉我什么被释放了。它是在CustomAnnotation类中定义的。