Tag Archives: selector

Flexible method calls with NSInvocation

I was recently working on a means to perform concurrent saves (for performance reasons) of some records to Parse .     As I worked through this I realized that there may be some benefit in creating a generic dispatcher that wasn’t tied to a particular source of those records.   My goal was to give this generic dispatcher the means to retrieve a total record count and set of records in a range, without having to know the details of where the count and records came from.

The dispatcher would also be given parameters that told it how many records to save at once (Parse has a saveAll feature for persisting objects to the cloud), along with how many saves to perform concurrently.


At first I explored using one or more selectors that I passed from my custom record save method to the generic dispatcher.     I quickly ran into the warning “performSelector may cause a leak because its selector is unknown”.  I found an excellent post on Stack Overflow that discusses this issue.  One proposed explanation for this warning was that since the selector is unknown to the compiler, ARC cannot enforce proper memory management.

Continue reading