HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – UITableView删除/添加行导致CoreData:严重应用程序错误,如果在SplitViewController的MasterView中选择了另一个对象大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
更新18/3#2.我已经开始计算beginupdates和Endupdates以确保它们是均匀的.就在出现异常之前,它们就会失去同步.不知道为什么.

更新18/3:我想我发现了问题,但我不确定我是否知道如何修复它.经过几个小时的实验,我发现当我在该会话期间在svc的主表视图中选择了多个项目时,我只能使应用程序崩溃.
当在主表视图中选择另一个项目时,详细信息表视图将获得一个新的对象集,并且如果它在更新/移动/删除/插入周期的中途,则称为刷新表.因此问题;我认为即使在detailviewcontroller上设置了新的故事对象,它也有更新旧故事对象的说明.

如何在详细视图中设置新故事之前完全处理动画/ coredata / tableview更新?我在setEditTing == NO时保存对managedObjectContext的更改.我猜我需要制作一个自定义的setStory setter,它在接受新对象之前处理UITableView / CoreData集的所有更新?

在didSELEctRowATindexPath中的svc的主tableview控制器上调用代码

[detailViewController setStory:storySet]; //where storySet is the new story object
[detailViewController refreshTables];

我尝试删除动作不会动画的行时出现间歇性错误,应用程序基本上会挂起以下错误(尽管从CoreData集中删除了行).如果我在一个会话中从svc中的主表视图控制器中选择了多行,则会发生这种情况.

在一些谷歌搜索后,我认为它可能是一个问题(void)控制器:(NSFetchedResultsController *)控制器didChangeObject:(id)在更新后调用,以动画用户所做的更改.

我该如何修复这些间歇性错误

> 16/3我试图真正简化我的代码.我删除了对托管对象上下文的所有调用并将它们放入setEdiTing,删除了多余的[self.tableview reloadData]和[self.tableview setneedsdisplay]并完全使’重新排序’bool无效(它仍然在代码中,但它总是设置为NO,所以没有区别). UITableView比以往任何时候都更加稳定,但我仍然设法在删除时出现间歇性错误(偶尔会添加) – 它似乎需要一段时间才能崩溃,但它仍然会.**
> 15/3:我认为它与CoreData / UITableView不同步有关–CoreData认为它比UITableView更少或更多
> CoreData集没有问题,它只是动画/ UI方面的东西(事情被删除)
>这是断断续续的,仅限于一些删除
>在来自railwayparade的一些帮助之后,我在didChangeObject中实现了NSFetchedResultsChangeMove:它修复了移动错误但没有修复删除错误.

谁能看到我错过的任何东西,或者我可以查看?很高兴提供更多信息,如果这有助于解决问题.

对于此处发布的淫秽数量代码表示歉意.

错误

//
//  MakeSentenCETableViewController.h
//  StoryBot
//
//  Created by Glen Storey on 25/10/10.
//  Copyright 2010 Glen Storey. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "AddStoryItem.h"
#import "Story.h"
#import "Sentence.h"


@interface MakeSentenCETableViewController : UITableViewController <NSFetchedResultsControllerDelegate,AddStoryItemDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,UITextFieldDelegate,UIPopoverControllerDelegate> {
    NsmanagedObjectContext      *managedObjectContext;  
    NSFetchedResultsController  *fetchedResultsController;
    UIPopoverController         *popoverController;
    UIBarButtonItem             *playButtonItem;
    UIBarButtonItem             *addButtonItem;

    BOOL                        reordering;
    BOOL                        insert;
    BOOL                        @R_618_9421@e;
    BOOL                        move;

    int                         beginupdatesCount;
    int                         endupdatesCount;

}
@property (nonatomic,retain)   Story *story;
@property (nonatomic,retain)   NsmanagedObjectContext *managedObjectContext;
@property (nonatomic,retain)   UIBarButtonItem *playButtonItem;
@property (nonatomic,retain)   UIBarButtonItem *addButtonItem;
@property BOOL reordering,insert,@R_618_9421@e,move;

-(IBACtion)createStorymodal:(id)sender;
-(void)refreshTables;
-(IBACtion)pushShare:(id)sender;


@end


//
//  MakeSentenCETableViewController.m
//  
//
//  Created by Glen Storey on 25/10/10.
//  Copyright 2010 Glen Storey. All rights reserved.
//

#import "MakeSentenCETableViewController.h"
#import "ShareViewController.h"
#import "StoryBotAppDelegate.h"

@implementation MakeSentenCETableViewController
@synthesize story,managedObjectContext,addButtonItem,playButtonItem,reordering,move;

-(void)addStoryItemAction:(NSString*)text order:(NSnumber*)order image:(NSString*)image thumb:(NSString*)thumb{

    NSLog(@"Text: %@,Order: %@,Image: %@.",text,order,imagE);
    NSLog(@"beginupdatesCount: %d vs. endupdatescount: %d",beginupdatesCount,endupdatesCount);

    NSSet *sentences = [story sentences];
    NSnumber *maxOrder = [sentences valueForKeyPath:@"@max.order"];
    NSLog(@"maxOrder: %@",maxOrder);

    if(maxOrder == 0){

        maxOrder = [[NSnumber alloc] initWithInteger: 0];
    }

    //make a new sentence!
    Sentence *sentence = [NSEntityDescription insertNewObjectForEntityForName:@"Sentence" 
                                                       inManagedObjectContext:managedObjectContext];

    [sentence setText: text];
    [sentence setImage: image];
    [sentence setThumb: thumb];
    [sentence setBelongsTo: story];
    if([maxOrder intValue] >= 1 ){
            [sentence setOrder: [[NSnumber alloc] initWithInteger:[maxOrder intValue]+1]]; 
    }else{
            [sentence setOrder: [[NSnumber alloc] initWithInteger:1]];
    }
    NSMutableSet *mutableSet = [[NSMutableSet alloc] initWithSet:sentences];
    [mutableSet addObject:sentence];

    //NSLog(@"sentences before setWithSet %@",mutableSet);

    sentences = [[NSSet alloc] initWithSet: mutableSet];

    //NSLog(@"sentences after setWithSet %@",sentences); 

    [story setSentences:sentences];

    //NSError *error;  

    //BOOL isSaved = [managedObjectContext save:&error];
    //NSLog(@"isSaved? %@",(isSaved ? @"YES" :@"NO ") );

    //if (!isSaved) {
        //NSLog(@"%@:%s Error saving context: %@",[self class],_cmd,[error localizedDescription]);
        //Don't worry about this warning - just rem it out when finished (just a log)
      //  return;
    //} 

    [sentences release];
    [mutableSet release];

    //[self.tableView reloadData];
    //[self.tableView setNeedsDisplay];
    [self dismissModalViewControllerAnimated:YES];  



}

#pragma mark -
#pragma mark View lifecycle

-(id)initWithNibName:(NSString*)name bundle:(NSBundle*)bundle;
{
    self = [super initWithNibName:name bundle:bundle];

    if (self) {

        self.title = @"My Stories";

        addButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 
                                                                                       target:self
                                                                                       action:@SELEctor(createStorymodal:)];

        playButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay 
                                                                                        target:self
                                                                                        action:@SELEctor(pushShare:)];
        if (UI_user_iNTERFACE_I@L_652_39@m() == UIUserInterfaceI@L_652_39@mPad) { 
            [addButtonItem setEnabled:NO];
            [playButtonItem setEnabled:NO];
        }


        NSArray* toolbarItems = [NSArray arrayWithObjects:
                                 addButtonItem,[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace 
                                                                               target:nil
                                                                               action:nil],nil];

        [toolbarItems makeObjectsPerformSELEctor:@SELEctor(releasE)];
        self.toolbarItems = toolbarItems;  

        //NSLog(@"self: %@ self.toolbarItems: %@",self,self.toolbarItems);


        //Do I need to release UIBarButtonItems? 

        NSLog(@"initWithNibName:");
    }



    return self;
}

-(void)refreshTables{

    //use this to refresh for new table content. Also calls self.tableview reloadData so you don't need to call it afterWARD. 

    NSLog(@"===================================refreshTables");
    NSLog(@"story object %@",story);

    if (managedObjectContext == nil) 
    { 
        NSLog(@"managedObjectContext == nil");
        managedObjectContext = [(StoryBotAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
        NSLog(@"After managedObjectContext: %@",managedObjectContext);
    }else{
        NSLog(@"managedObjectContext != nil");
    }



    NSFetchrequest *request = [[NSFetchrequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Sentence" inManagedObjectContext:managedObjectContext];
    [request setEntity:entity];

    //sorTing stuff:
    NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"order" ascending: YES];
    NSArray *sortDescriptors = [[NSArray alloc] initWithObjects: sortDescriptor,nil];
    [request setSortDescriptors:sortDescriptors];
    [sortDescriptors release];
    [sortDescriptor release];

    NSPreDicate *preDicatetitle = [NSPreDicate preDicateWithFormat:@"belongsTo=%@",story];
    [request setPreDicate :preDicatetitle];

    NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
    [dateFormatter setDateFormat:@"EEE,d MMM yyyy HH:mm:ss"];
    NSString *dateString = [dateFormatter StringFromDate:[story creationDate]];

    NSLog(@"dateString: %@",dateString);

    fetchedResultsController = [[NSFetchedResultsController alloc] 
                                initWithFetchrequest:request managedObjectContext:managedObjectContext 
                                sectionNameKeyPath:nil cachename:dateString];

    fetchedResultsController.delegate = self;

    [request release];

    NSError *error;
    [fetchedResultsController performFetch:&error];

    [self.tableView reloadData];

}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = @"My Story";

    NSLog(@"Passed Story Object: %@",story);
    //NSLog(@"managedObjectContext: %@",managedObjectContext); 
    //Need a preDicate for belongsTo here.

    self.tableView.rowHeight = 50;

    if(story != NULL){
        if (managedObjectContext == nil) 
        { 
            NSLog(@"managedObjectContext == nil");
            managedObjectContext = [(StoryBotAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
            NSLog(@"After managedObjectContext: %@",managedObjectContext);
        }else{
            NSLog(@"managedObjectContext != nil");
        }



        NSFetchrequest *request = [[NSFetchrequest alloc] init];
        NSEntityDescription *entity = [NSEntityDescription entityForName:@"Sentence" inManagedObjectContext:managedObjectContext];
        [request setEntity:entity];

        //sorTing stuff:
        NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"order" ascending: YES];
        NSArray *sortDescriptors = [[NSArray alloc] initWithObjects: sortDescriptor,nil];
        [request setSortDescriptors:sortDescriptors];
        [sortDescriptors release];
        [sortDescriptor release];

        NSPreDicate *preDicatetitle = [NSPreDicate preDicateWithFormat:@"belongsTo=%@",story];
        [request setPreDicate :preDicatetitle];



        fetchedResultsController = [[NSFetchedResultsController alloc] 
                                    initWithFetchrequest:request managedObjectContext:managedObjectContext 
                                    sectionNameKeyPath:nil cachename:nil];

        fetchedResultsController.delegate = self;

        [request release];

        NSError *error;
        [fetchedResultsController performFetch:&error];




    }



#pragma mark -
#pragma mark Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    // Return the number of sections.
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    //Return the number of rows in the section.
    NSArray *sections = [fetchedResultsController sections];
    NSInteger count = 0;

    if ([sections count]){
        id <NSFetchedResultsSectionInfo> sectionInfo = [sections objectATindex:section];
        count = [sectionInfo numberOfObjects];

    }
    NSLog(@"# of rows in section %d",count);
    return count;

}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowATindexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reusEIDentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...

    Sentence *sentenceAtCell = [fetchedResultsController objectATindexPath:indexPath];
    //NSLog(@"sentenceAtCell: %@",sentenceAtCell);

    cell.textLabel.text = [sentenceAtCell text];



    NSArray *paths       = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); 
    NSString *uniquePath = [[paths objectATindex:0] StringByAppendingPathComponent:[sentenceAtCell thumb]];


    // This should crop it as you want - you've just got to create cropRect.

    UIImage *largeImage = [UIImage imageWithContentsOfFile: uniquePath];
    CGRect cropRect = CGRectMake(0,66,50); 


    /*if ([[UIScreen mainScreen] respondsToSELEctor:@SELEctor(scalE)]) {
        if ([[UIScreen mainScreen] scale] == 2) {
            // running an iPhone 4 or equiv. res device.
            cropRect = CGRectMake(15,14,100,75); 
        }
    }*/


    CGImageRef imageRef = CGImageCreateWithImageInRect([largeImage CGImage],cropRect);
    cell.imageView.image = [UIImage imageWithCGImage: imageRef];
    CGImageRelease(imageRef);



    //NSLog(@"indexPath: %@",indexPath);

    return cell;
}

// Override to support ediTing the table view.
- (void)tableView:(UITableView *)tableView commitEdiTingStyle:(UITableViewCellEdiTingStylE)ediTingStyle forRowATindexPath:(NSIndexPath *)indexPath {
    if (ediTingStyle == UITableViewCellEdiTingStyleDelete) {

        NSLog(@"@R_618_9421@e row");
        NSFileManager *fileManager = [NSFileManager defaultManager];
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,YES); 
        NSString *documentsDirectoryPath = [paths objectATindex:0];


        //  1. Look at the sentence we're about to @R_618_9421@e.
        Sentence *sentenceRetire =      [fetchedResultsController objectATindexPath:indexPath];
        //  2. Does it have an order of 0? 
        NSLog(@"=================== sentenceRetire: %@",sentenceRetirE);


        if([[sentenceRetire order] intValue] == 0){
                //      YES: Is there another sentence in this story?
                Story *storyRetire                      = [sentenceRetire belongsTo];
                NSSet *sentencesInRetiredSentenceSet    = [storyRetire sentences];


                if ([sentencesInRetiredSentenceSet count] > 1){
                    //          YES:    Set the sentence with the smallest order to an order of 0   
                    //                  then @R_618_9421@e the sentence + files

                    NSPreDicate *preDicatetitle             = [NSPreDicate preDicateWithFormat:@"order>0"];
                    NSSet *sentencesWithPotentialToBetitle  = [sentencesInRetiredSentenceSet filteredSetUsingPreDicate:preDicatetitle];
                    NSnumber *minOrder                      = [sentencesWithPotentialToBetitle valueForKeyPath:@"@min.order"];  

                    NSPreDicate *preDicateOrder             = [NSPreDicate preDicateWithFormat:@"order=%d",[minOrder intValue]];
                    NSSet *sentenceWithPotentialToBetitle   = [sentencesWithPotentialToBetitle filteredSetUsingPreDicate:preDicateOrder];   

                    //note the sentence (singular) not sentences. This is the sentence who's order needs to be updated.     
                    NSLog(@"setenceWithPotentialToBetitle (check order isn't null on crash): %@",sentenceWithPotentialToBetitlE);  
                    Sentence *sentenCEToPromote = [sentenceWithPotentialToBetitle anyObject];

                    //Now we kNow which sentence to promote we can @R_618_9421@e the sentence & Files.     
                    [managedObjectContext @R_618_9421@eObject:[fetchedResultsController objectATindexPath:indexPath]];

                    NSString *imageTrash = [documentsDirectoryPath StringByAppendingPathComponent:(NSString*)[sentenceRetire image]];
                    NSString *thumbTrash = [documentsDirectoryPath StringByAppendingPathComponent:[sentenceRetire thumb]];

                    NSLog(@"About to @R_618_9421@e these files: %@,%@",imageTrash,thumbTrash);

                    [fileManager removeItemAtPath:imageTrash error:NULL];
                    [fileManager removeItemAtPath:thumbTrash error:NULL];

                    //and promote the new title.    
                    [sentenCEToPromote setOrder:[[NSnumber alloc] initWithInteger:0]];



                }else{
                    //          NO:     We're @R_618_9421@ing this story
                    //                  @R_618_9421@e the files! 
                    [managedObjectContext @R_618_9421@eObject:storyRetire]; 
                    NSString *imageTrash = [documentsDirectoryPath StringByAppendingPathComponent:(NSString*)[sentenceRetire image]];
                    NSString *thumbTrash = [documentsDirectoryPath StringByAppendingPathComponent:[sentenceRetire thumb]];

                    //NSLog(@"About to @R_618_9421@e these files: %@,thumbTrash);

                    [fileManager removeItemAtPath:imageTrash error:NULL];
                    [fileManager removeItemAtPath:thumbTrash error:NULL];

                //Pop BACk. 
                    if (UI_user_iNTERFACE_I@L_652_39@m() == UIUserInterfaceI@L_652_39@mPad) {      
                        NSLog(@"last sentence in story - @R_618_9421@e that story and point,somewhere!");
                        //probably @R_618_9421@e the sentece to clear the table,then @R_618_9421@e the story using storyRetire

                    } else{
                        [self.navigationController popViewControllerAnimated:YES];
                    }
            }

        }else{
        //  NO: @R_618_9421@e the Sentence Object. 
            [managedObjectContext @R_618_9421@eObject:[fetchedResultsController objectATindexPath:indexPath]];

            NSString *imageTrash = [documentsDirectoryPath StringByAppendingPathComponent:(NSString*)[sentenceRetire image]];
            NSString *thumbTrash = [documentsDirectoryPath StringByAppendingPathComponent:[sentenceRetire thumb]];

            //NSLog(@"About to @R_618_9421@e these files: %@,thumbTrash);

            [fileManager removeItemAtPath:imageTrash error:NULL];
            [fileManager removeItemAtPath:thumbTrash error:NULL];

        }


        // Save the context.
        //NSError *error;
        //if (![managedObjectContext save:&error]) {
            /*
             replace this implementation with code to handle the error appropriately.

             abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application,although it may be useful during development. If it is not possible to recover from the error,display an alert panel that instructs the user to quit the application by pressing the Home button.
             */
        //  NSLog(@"Unresolved error %@,error,[error userInfo]);
        //  abort();
        //}

    }

}


- (void)setEdiTing:(BOOL)ediTing animated:(BOOL)animated
{
    [super setEdiTing:ediTing animated:animated];
    if (!ediTing) {
        //save here
        NSError *error;
        BOOL isSaved = [managedObjectContext save:&error];
        NSLog(@"isSaved? %@ ======================================",(isSaved ? @"YES" :@"NO ") );
    }
}


// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowATindexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
    //this implementation is from here: http://www.cimgf.com/2010/06/05/re-ordering-nsfetchedresultscontroller/

    NSMutableArray *things = [[fetchedResultsController fetchedObjects] mutableCopy];

    // Grab the item we're moving.
    NsmanagedObject *thing = [fetchedResultsController objectATindexPath:fromIndexPath];

    // Remove the object we're moving from the array.
    [things removeObject:thing];
    // Now re-insert it at the desTination.
    [things insertObject:thing aTindex:[toIndexPath row]];

    // All of the objects are Now in their correct order. update each
    // object's displayOrder field by iterating through the array.


    int i = 0;
    for (NsmanagedObject *mo in things)
    {
        [mo SETVALue:[NSnumber numberWithInt:i++] forKey:@"order"];
    }


    NSLog(@"things: %@",things);
    [things release],things = nil; 

    //reordering = YES;
    //NSLog(@"moveRowATindexPath: IS reordering");
    //NSError *error;  
    //[managedObjectContext save:&error];   




}



#pragma mark -
#pragma mark Table view delegate
/**
 Delegate methods of NSFetchedResultsController to respond to additions,removals and so on.
 */

- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {

    // The fetch controller is about to start sending change notifications,so prepare the table view for updates.
    NSLog(@"controllerWillChangeContent: Beginupdates");

    [self.tableView beginupdates];

    beginupdatesCount++;
    NSLog(@"====================beginupdates was just incremented");
    NSLog(@"beginupdatesCount %d",beginupdatesCount);
    NSLog(@"endupdatesCount   %d",endupdatesCount);

}


- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject aTindexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeTypE)type newIndexPath:(NSIndexPath *)newIndexPath {

    NSLog(@"didChangeObject: %@",anObject);

    UITableView *tableView;
    tableView = self.tableView;

    switch(typE) {
        case NSFetchedResultsChangeInsert:
            NSLog(@"ResultsChangeInsert:");
            insert = YES;
            [tableView insertRowsATindexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];

            break;

        case NSFetchedResultsChange@R_618_9421@e:
            NSLog(@"ResultsChange@R_618_9421@e:");
            @R_618_9421@e = YES;
            [tableView @R_618_9421@eRowsATindexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];

            break;

        case NSFetchedResultsChangeMove:
            NSLog(@"ResultsChangeMove:");
            move = YES;
            [tableView @R_618_9421@eRowsATindexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
            [tableView insertRowsATindexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationNone];
            break;

        default:
            NSLog(@"switch problem - default");
    }

}

- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo aTindex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeTypE)type {

    NSLog(@"didChangeSection:");
    switch(typE) {
        case NSFetchedResultsChangeInsert:
            [self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
            break;

        case NSFetchedResultsChange@R_618_9421@e:
            [self.tableView @R_618_9421@eSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
            break;

        }
}


- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {

    NSLog(@"didChangeContent");
    // The fetch controller has sent all current change notifications,so tell the table view to process all updates.
    NSLog(@"almost endupdates==============================================");
    if(Delete){
        NSLog(@"endupdates @R_618_9421@e");
        @R_618_9421@e = NO;
    }
    if(movE){
        NSLog(@"endupdates move");
        move = NO;
    }
    if(insert){
        NSLog(@"endupdates insert");
        insert = NO;
    }

    [self.tableView endupdates];
    endupdatesCount++;

    NSLog(@"====================endupdates was just incremented");
    NSLog(@"endupdatesCount   %d",endupdatesCount);
    NSLog(@"beginupdatesCount %d",beginupdatesCount);

    NSLog(@"endupdates finished");

}


#pragma mark -
#pragma mark Memory management

- (void)dealloc {
    NSLog(@"Dealloc Sentence");
    //[fliteENGIne stopTalking];
    //[fliteENGIne release];
    addButtonItem   = nil;
    playButtonItem  = nil;

    if (UI_user_iNTERFACE_I@L_652_39@m() == UIUserInterfaceI@L_652_39@mPad) { 
        //It doesn't seem to get allocated because it's not set on the iPhone. 
        [addButtonItem  release];
        [playButtonItem release];
    }

    [story release];
    [fetchedResultsController release];

    [super dealloc];
}


@end

解决方法

更新18/3#3我读了 this question关于fetchedResultsController需要在创建一个新委托之前将其委托设置为nil.我放
detailViewController.fetchedResultsController = nil;
detailViewController.fetchedResultsController.delegate = nil;

在didSELEctrowaTindexpath的SVC主视图中,问题已经停止.每次在主视图中选择一行时,refreshTables都会创建一个新的fetchedResultsController,我认为即使选择了新的故事对象,它们仍然会干扰.

大佬总结

以上是大佬教程为你收集整理的ios – UITableView删除/添加行导致CoreData:严重应用程序错误,如果在SplitViewController的MasterView中选择了另一个对象全部内容,希望文章能够帮你解决ios – UITableView删除/添加行导致CoreData:严重应用程序错误,如果在SplitViewController的MasterView中选择了另一个对象所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。