1
votes

I am trying to use PFIncrementalStore, http://sbonami.github.io/PFIncrementalStore/

After setting up as instruction, I get the following error at [context performBlock:^,

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can only use -performBlock: on an NSManagedObjectContext that was created with a queue.'

Some internet search said, NSManagedObjectContext must be created with NSPrivateQueueConcurrencyType.

If I look up all "NSManagedObjectContext init" in PFIncrementalStore.m, I get two occurrence of

_backingManagedObjectContext = [[NSManagedObjectContext alloc]     initWithConcurrencyType:NSPrivateQueueConcurrencyType];
NSManagedObjectContext *childContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];

Why am I getting that error? How should I edit PFIncrementalStore? Thanks.

1

1 Answers

3
votes

I solved it by replacing

_managedObjectContext = [[NSManagedObjectContext alloc] init];

with

_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];