cocoa - How do I specify the block object / predicate required by NSDictionary's keysOfEntriesPassingTest? -


For learning purposes (for practical - yet) purposes, I use the following method on an NSDictionary to give me If a group of keys has been returned using a test defined by me, unfortunately, do not know how to specify the ingenious.

  NSASA KeysofprintspringTest: - (NSSET *) KeyofentrespacingTest: Understanding Bull (^) (ID, AD OBJ, BOL * stop))  

example For, all my values ​​are NSURL, and I would like to return all the URLs present on port 8080. Here is my busted coding - although it is not really, I understand that this would be correct:

NSSet * mySet = [myDict keys * Stop) {If ([[Ozbase port] is Eval: [NSNumber numbers: 8080]]) {return key; }]

And that's because I get the following compiler error back:

Incompatible block pointer type 'zero' ('^' ( Struct objc_object *, struct (*) Objc_object *, BOOL *), 'Expected' BOOL (^) (struct objc_object *, struct objc_object *, bool *) '

What do I remember I am appreciating an indicator on some docs which goes into more detail about "Block Object" which is considered predicate thanks!


And this is the code that works:

  NSSet * mySet = [myDict keyoffsPassing: ^ (id key, id obj, bool * stop) {if ([[ozbase port] is aval: [nsnumber number with int: 8080]] ya back Return; and do not return;}];  

An error indicates that your block Back to BOOL , check the documents instead of id I suspect that you expect to return yes if the key / obz pair is desired Pass the exam She is


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -