ios - Add code in a completion block parameter -


sorry if question has been asked. can't find keywords have answer...

in completion block, possible add code before or after block variable?

i this:

- (void)presentviewcontroller:(uiviewcontroller *)viewcontrollertopresent animated:(bool)flag completion:(void (^)(void))completion {     [super presentviewcontroller:viewcontrollertopresent animated:flag completion:^{         //some code add here         completion();     }]; } 

i have exc_bad_access error when try this.

edit: issue caused use of "completion()" without checking if nil or not.

of course can add code have comment. crash caused other problem, un-initialized variable, or perhaps using local variable has gone out of scope.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -