Frage

I tried using isEqualToSet for comparing two sets based on a particular attribute as suggested in the link. But after implementing the logic I found it wasn't working and I dint know the reason. It would be helpful if someone can suggest where I m going wrong or some alternative solution.. This is my code:

if([[[obj ofServer] valueForKey:@"name"] isEqualToSet:[serverSet valueForKey:@"name"]])
{
   NSLog(@"handle both equal case");
}
NSLog(@"db log %@ and current logs server %@ \n",[[obj ofServer] valueForKey:@"name"],[serverSet valueForKey:@"name"]);

The output in console is showing the same set

db log {(
    "f7.net"
)} and current logs server {(
        (
        "f7.net"
    )
)}
War es hilfreich?

Lösung

Looking at the log appears you have 2 different sets. I mean you are comparing

(
    "f7.net"
)

with

((
        "f7.net"
    ))

Hope this help

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top