I have two entities, User & Message.
However I want to fetch all users who have sent any messages and with their latest sent message fetched together.
I've try fetch message and set predicate
created_at = sender.sentMessages.@max.created_at
but the compiler told me unable to parse sql statement? How can I do that?
Is that exactly how you called it in your code? The @ operators are keyValue programming operators on collections, so you need to access them via key value semantics. Try:
created_at = [sender valueForKeyPath:@"sentMessages.@max.created_at"];
See
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.