Member-only story
Assign a variable inside a Block to a variable outside a Block
1 min readNov 14, 2019
Variable is not assignable (missing __block type specifier)
on the line aPerson = participant;
. How can I make sure the block can access the aPerson
variable and the aPerson
variable can be returned?
__block Person *aPerson = nil;
For more details, please refer to this tutorial: Blocks and Variables
or
__block CGFloat docHeight = 0.0;
[self evaluateJavaScript:@"document.height" completionHandler:^(id height, NSError *error) {
//height
NSLog(@"=========>document.height:@%@",height);
docHeight = [height floatValue];
}];
and its working fine
Just add "__block" before Variable.
For more about iOS development : https://medium.com/@javedmultani16
Some useful codes and libraries: https://github.com/javedmultani16
Know more about me: https://www.linkedin.com/in/javedmultani16/