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

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

python - Pygame screen.blit not working -

c# - Web API response xml language -