I have the following function
- (void)loginWithCompletionBlock:(void (^)(BOOL))completion
How do I call it? How do I pass a BOOL as a block? I’ve tried several ways and I don’t seem to understand how this works.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re not passing “a
BOOLas a block”, you’re passing a block that will later be passed aBOOL.loginWithCompletionBlock:is presumably going to go off and try to log in to some service. When the attempt has ended, either in success or failure, your block, which is a piece of executable code, will be run, and will be passed aBOOLvalue byloginWithCompletionBlock:Incidentally, the name of the
BOOLcan be whatever you like, although usually the API you’re using will give it a name (such assuccess) to indicate its meaning.