How do I get the latest record when fetching records?
for example:
Now when i fetch it
SomeDatabase *Country = [SomeDatabase MR_findFirst];
NSLog(@"Country Name---->%@",Country.Name);
I get "Singapore",
I want get the last record inserted to coredata, which is supposed to be "USA".
The most straight forward way is to add a "createdDate" or similar date field to your entity. Then you can simply use the query:
[MyEntity MR_findFirstOrderedByAttribute:@"createdDate" ascending:NO];