错误:Bool不能转换为void: [英] Error: Bool is not Convertible to Void:
问题描述
我从Obj移动我的代码。 C到Swift C并试图实现Twitter sdk ..
但是,我收到一个错误...
任何机构都可以告诉我我有什么完成错误。
p>
请帮助我。
我花了2天试过一切,但没有为我工作。 p>
您的块没有返回语句,因此编译器
使用最后一个语句的结果
UIApplication.sharedApplication()。openURL(url)
作为返回值,这是一个 Bool
,而不是 Void
块签名。
要解决这个问题,只需添加一个return语句:
{(url:NSURL,oauthToken:String) - >无效
UIApplication.sharedApplication()。openURL(url)
return
}
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.
Please help me with this.
I spent 2 days tried everything but didn't work for me.
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
}
这篇关于错误:Bool不能转换为void:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!