When I saw the same error, I tried to resolve it like:
__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.