Core Data app crashing with “controllerWillChangeContent : unrecognized selector sent to instance”

后端 未结 2 1436
北荒
北荒 2021-01-02 18:53

I\'ve got a core data app with 2 views. The first view lists \"Rooms\", the second lists \"Scenes\" in rooms. The Rooms page has an edit NavItem button, which when pressed e

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-02 19:34

    Even I faced the same issue. But for iOS 4.2 the problem is NSError is initialized, so it is treated as garbage and while updating/inserting we have

    if (![managedObjectContext save:&error]) {
            NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
            exit(-1);
        }
    

    So in save the iOS treats the error as garbage and so the exception. Try to initialize it to nil. It solved my problem. The issue is seen only with 4.2iOS.

提交回复
热议问题