Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MR_executeFetchRequestAndReturnFirstObject with [request setResultType:NSDictionaryResultType] leads to compiler warning #1396

Open
donnerluetjen opened this issue Jan 15, 2025 · 0 comments

Comments

@donnerluetjen
Copy link

donnerluetjen commented Jan 15, 2025

In NSManagedObject+MagicalAggregation the method MR_aggregateOperation has the following lines:

NSFetchRequest *request = [self MR_requestAllWithPredicate:predicate inContext:context];
    [request setPropertiesToFetch:properties];
    [request setResultType:NSDictionaryResultType];    
    
    NSDictionary *resultsDictionary = [self MR_executeFetchRequestAndReturnFirstObject:request inContext:context];

This results in a compiler warning
Incompatible pointer types initializing 'NSDictionary *' with an expression of type 'NSManagedObject * _Nullable'
because the compiler does not know about the set result type.

I think the call here needs an explicit type cast, like so
NSDictionary *resultsDictionary = (NSDictionary *)[self MR_executeFetchRequestAndReturnFirstObject:request inContext:context];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant