-1
的我完全新的API,和我下面这个教程appcoda https://www.appcoda.com/dropbox-api-tutorial/使用未解决的标识符“URL”
它已经持续很顺利,但我碰到的一个问题,因为我我是一个新手,我不知道如何解决这个问题。
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let appKey = "n00nzv68gtxk6c9" // Set your own app key value here.
let appSecret = "itumv0icksr7yj6" // Set your own app secret value here.
let dropboxSession = DBSession(appKey: appKey, appSecret: appSecret, root: kDBRootDropbox)
DBSession.setShared(dropboxSession)
return true
if DBSession.sharedSession().handleOpenURL(url) {
if DBSession.shared().isLinked() {
NotificationCenter.defaultCenter.postNotificationName("didLinkToDropboxAccountNotification", object: nil)
return true
}
}
return false
}
的问题是在该行
if DBSession.sharedSession().handleOpenURL(url) {
在那里我得到的错误
Use of unresolved identifier 'url'
什么我需要做什么?
您也需要您尝试使用它之前正确声明并初始化一个命名变量'url'或者您需要用另一个'URL'类型变量替换'url'。 – rmaddy
它应该是什么类型? –
另请注意,'if DBSession ...'块的放置方式与放入的完全不同。 – rmaddy