Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Bool is not Convertible to Void:

I am moving my code from Obj. C to Swift C and trying to implementing the Twitter sdk..

But, I am getting an error... Can any body tell me what I have done wrong.

enter image description here

Please help me with this.

I spent 2 days tried everything but didn't work for me.

like image 893
R_Developer Avatar asked Aug 22 '14 11:08

R_Developer


1 Answers

Your block does not have a return statement, therefore the compiler uses the result of the last statement

UIApplication.sharedApplication().openURL(url)

as return value, which is a Bool and not Void as declared in the block signature.

To solve that problem, just add a return statement:

{ (url: NSURL, oauthToken: String) -> Void in
    UIApplication.sharedApplication().openURL(url)
    return
}
like image 191
Martin R Avatar answered Nov 04 '22 22:11

Martin R