首页 > 解决方案 > 在 iOS/Swift 中使用 VimeoNetworking 设置客户端时出错

问题描述

我已经通过 Cocoapods 在我的项目中安装了 VimeoNetworking,并且我正在使用 XCode 12.5。尝试设置客户端,以便我可以浏览 Vimeo 中的可用视频。我已经按照每个步骤从这里这里开始,并且我正在为我的帐户使用正确的客户端标识符和客户端密码。使用下面的代码,对于 vimeoClient 声明,我收到错误“调用中的参数 'configureSessionManagerBlock' 的参数缺失”,对于 authenticationController 声明,出现“调用中的参数 'appConfiguration','configureSessionManagerBlock' 的参数缺失”。我完全从两个 Vimeo 开发人员站点复制了示例代码。知道为什么 Vimeo 文档和示例代码不起作用吗?

import UIKit
import VimeoNetworking
 
 class PhotoAlbumVC: UIViewController {

// overridden ---------------------

override func viewDidLoad() {
    super.viewDidLoad()
    
    let appConfiguration = AppConfiguration(
        clientIdentifier: "foobar",
        clientSecret: "blahblahblah",
        scopes: [.Public, .Private, .Interact], keychainService: "vimeo")

    let vimeoClient = VimeoClient(appConfiguration: appConfiguration)
    
    let authenticationController = AuthenticationController(client: vimeoClient)
    

    authenticationController.clientCredentialsGrant { result in
        switch result {
        case .Success(let account):
            print("Successfully authenticated with account: \(account)")
        case .Failure(let error):
            print("error authenticating: \(error)")
        }
    }
}

}

标签: vimeovimeo-ios

解决方案


推荐阅读