NSDictionary expects its keys and values ββto be pointers to Objective-C objects. In image_size , you have NSUInteger, which is a primitive type (unsigned long).
So, to save a primitive type value in an NSDictionary, you have to wrap it in NSNumber or NSValue. With newer versions of LLVM, this is a simple expression:
@(image_size) // this will give you an NSNumber *
Or, if you have a senior compiler, then something like this:
[NSNumber numberWithUnsignedLong:image_size]
Hope this helps.
By the way, I'm not sure about using a block in this case. It seems that the motivation was for the __block variable to be equivalent to the out parameter and nothing more? You can only think that it is a separate function or method that takes NSUInteger * as an out parameter. Not a problem here, but something to consider it a bit.
source share