Need help declaring and implementing a method with blocks but no parameters. Sounds simple but I'm missing something because this works:
- (void) RetrieveDevices: (NSInteger)count
success:(void (^)(NSMutableArray *devices))success
failure:(void (^)(aylaError *err))failure;
- (void)RetrieveDevices:(NSInteger)count
success:(void (^)(NSMutableArray *devices))successBlock
failure:(void (^)(aylaError *err))failureBlock
{
}
And this won't compile as it's expecting a method body:
- (void) RetrieveDevices
success:(void (^)(NSMutableArray *devices))success
failure:(void (^)(aylaError *err))failure;
- (void)RetrieveDevices
success:(void (^)(NSMutableArray *devices))successBlock
failure:(void (^)(aylaError *err))failureBlock
{
}
Appreciate the help.
declare verb (EXPRESS) B2 [ T ] to announce something clearly, firmly, publicly, or officially: They declared their support for the proposal. [ + (that) ] She declared (that) it was the best chocolate cake she had ever tasted. [ + obj + (to be) + noun/adj ] They declared themselves (to be) bankrupt.
Declare is a nutrition label for building products. It is designed to help specifiers quickly identify products that meet their project requirements. Declare labels disclose all intentionally-added ingredients and residuals at or above 100ppm (0.01%) present in the final product by weight.
declare verb (EXPRESS) B2 [ T ] to announce something clearly, firmly, publicly, or officially: They declared their support for the proposal
How does the verb declare differ from other similar words? Some common synonyms of declare are announce, proclaim, and promulgate. While all these words mean "to make known publicly," declare implies explicitness and usually formality in making known. Where would announce be a reasonable alternative to declare?
Blocks are parameters. So you want a method signature with two parameters. Try e.g.:
- (void) RetrieveDevicesWithSuccess:(void (^)(NSMutableArray *devices))success
failure:(void (^)(aylaError *err))failure;
The problem is the newline and whitespace between "RetrieveDevices" and "success"/"failure". Try this instead:
- (void)RetrieveDevicesOnSuccess:(void (^)(NSMutableArray *devices))successBlock
onFailure:(void (^)(aylaError *err))failureBlock
{
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With