I have a method like this
-(void)GetPostPreperation :(NSMutableURLRequest *)request :(BOOL)isGet :(NSMutableDictionary *)jsonBody :(void(^)(NSString*)) compblock
how can I pass parameter into this within a block? I tried like this. but it giving me an syntax error, Expected Expression
This is the way I tried
[self GetPostPreperation:request :isGet :jsonBody :(^NSString*)str
{
return str;
}];
This is how I defined my block
typedef void(^myCompletion)(NSString *);
I want to assign a NSString
value to the block parameter within my GetPostPreperation
method and check and return it from the block calling method.How can I do this? Please help me.
Thanks
Use it in this way,here str
is an input not return
[self GetPostPreperation:request :true : jsonBody :^(NSString * str) {
//here use
NSLog(@"%@",str);
}];
Update
do not return anything from this block.The block type is void(^)(NSString*)
,the return is void