我已经集成到 ios 应用程序 VimeoNetworking 中,直接使用来自 git 的代码,因为我无法使用 cocoapods(不兼容使用 use_frameworks!与其他 pod)进行集成以获取某些视频的私人链接(我有一个专业帐户)。
我能够验证和请求视频信息。当请求返回并分配给类 (VIMVideo) 时,对象未正确加载。
如果我得到返回的响应正确返回包含视频信息的 30 个项目的字典。
我检查了 VimeoNetworking 示例代码中的相同代码,它在另一个项目中有效(使用相同的凭据,只有不同的一个使用 Vimeo 的 pod,另一个不使用)
如果我比较两个 json 响应,它们都具有相同的数据但顺序不同。我觉得问题出在 AFNetworking (3.1.0) 使用的反序列化
以前的身份验证
let authenticationController = AuthenticationController(client: VimeoClient.defaultClient, appConfiguration: AppConfiguration.defaultConfiguration, configureSessionManagerBlock: nil)
authenticationController.accessToken(token:tkn) { result in
switch result
{
case .success(let account):
print("authenticated successfully: \(account)")
break;
case .failure(let error):
print("failure authenticating: \(error)")
}
}
视频请求
let requestdir: Request<VIMVideo> = Request<VIMVideo>(path: "/videos/XXXXXXXX")
let _ = VimeoClient.defaultClient.request(requestdir) { [weak self] result in
switch result
{
case .success(let response):
//Here videodir have not value, but
var videodir: VIMVideo! = response.model
case .failure(let error):
let title = "Video Request Failed"
let message = "\(requestdir.path) could not be loaded: \(error.localizedDescription)"
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
let action = UIAlertAction(title: "OK", style: .default, handler: nil)
alert.addAction(action)
strongSelf.present(alert, animated: true, completion: nil)
}
}
控制台捕获 ( 1 )
来自 VIMEO 示例的 Pod 文件(提取)
def shared_pods
pod 'AFNetworking', '3.1.0'
pod 'SwiftLint', '0.25.1'
pod 'VimeoNetworking', :path => '../VimeoNetworking'
end
我的项目中的 Pod 文件(提取)
target 'LibroDig' do
pod 'RestKit', '~> 0.27.3'
pod 'JSONModel'
pod 'SDWebImage', '~>3.8'
pod 'AFNetworking', '3.1.0'
end
我希望 VIMVideo 正确加载所有属性。我无法找到这两种实现之间的区别。
提前致谢