“NSURL”不能隐式转换为“URL”;你的意思是使用“as”来明确转换?在迅速3

时间:2016-09-28 06:12:03

标签: swift swift3

Error

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool
{
    return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}

1 个答案:

答案 0 :(得分:3)

swift 3.0 中,openURL的方法签名为:

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {

            return FBSDKApplicationDelegate.sharedInstance().application(applic‌​ation, open: url, sourceApplication: sourceApplication, annotation: annotation)
    }

在方法签名中,NSURL更改为URL