I have a structure in Core Data like this:
Cliente
--- id = inteiro
--- dados = Pessoa
Pessoa
--- nome = string
PessoaFisica < Pessoa
--- cpf = string
PessoaJuridica < Pessoa
--- cnpj = string
How can I filter Customer based on the documents depending on the type of person? For example, fetch a client according to cpf .
If I do this right, he does not understand the inheritance and says he did not find cpf in Person :
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"dados.cpf = %@", cpf];
I needed some sort of casting of data for Person . Any suggestions?