magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.8k forks source link

MR_contextForCurrentThread deprecated #1288

Open duzenko opened 7 years ago

duzenko commented 7 years ago

I inherited a large project that used a previous version of MagicalRecord. After updating pods I got a load of deprecated warnings. I was able to fix most of them, but this particular one is a problem.

+ (instancetype)findFirstByAssociation:(Association *)association inContext:(NSManagedObjectContext *)context
{
    NSPredicate *userAssociationPredicate = [self userAssociationPredicate:association];
    return [self MR_findFirstWithPredicate:userAssociationPredicate inContext:context];
}

+ (instancetype)findFirstByAssociation:(Association *)association id:(NSString *)id
{
    return [self findFirstByAssociation:association id:id inContext:[NSManagedObjectContext MR_contextForCurrentThread]];
}

What is the best way to replace MR_contextForCurrentThread in this example?