0

I have integrated in a ios app VimeoNetworking , using the code from the git directly because i cannot integrate using cocoapods (not compatible use of use_frameworks! with other pods) for getting private link to some videos (i have a pro account).

I'm able to authenticate and request video info. When the request is returned and assigned to the class (VIMVideo) the object is not loaded correctly.

If i get the response returned returns correctly a dictionary of 30 items with the video info.

I have checked the same code from the VimeoNetworking example code and it's works in the other project (using same credentials, only different one use pod of Vimeo and the other not)

If i compare the two json responses, both have the same data but in a different order. I have the feeling that the problem is with the de-serialization used by AFNetworking (3.1.0)

Previous authentication

  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)")
            }
        }

Video Request

        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)
            }
        }

Console capture (1)

Pod file from VIMEO EXAMPLE (Extract)

def shared_pods
    pod 'AFNetworking', '3.1.0'
    pod 'SwiftLint', '0.25.1'
    pod 'VimeoNetworking', :path => '../VimeoNetworking'
end

Pod file from my project (Extract)

target 'LibroDig' do
   pod 'RestKit', '~> 0.27.3'
   pod 'JSONModel'
   pod 'SDWebImage', '~>3.8'
   pod 'AFNetworking', '3.1.0'
end

I expected the VIMVideo load correctly all the properties. I'm unable to find the difference between the 2 implementations.

Thanks in advance

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

0

If everything else is the same, you might be running into issues from opting out of using use_frameworks!.

For example, when I remove this from the Podfile used in the VimeoNetworking example project, I'll see this warning:

The Swift pod VimeoNetworking-iOS depends upon AFNetworking-iOS, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.

This article explains the need for use_modular_headers! and mentions interoperability with Objective-C. VimeoNetworking relies on model classes defined in Objective-C, and I wonder if mapping to those models is being affected.

  • I will read the article for improve my knowledge , thanks.Tested if the problem was afnetworking with RestKit, and works ok. The problem was the token to access Vimeo, with the update of the libraries i have to generate a new one. With the token , all works again. https://github.com/vimeo/VimeoNetworking/pull/308 – extremeKaos May 06 '19 at 16:45