简体   繁体   中英

How can we use DJIWidget in a cocoapod framework

I'm struggling trying to include the DJIWidget in our cocoapod dev environment.

We have a cocoapod framework with our DJI source, in which we'd like to include the DJIWidget as a dependency to use the DJIVideoPreviewer, but every way I try I can't get it to work, the main problem being the FFmpeg static binary.

With the old VideoPreviewer we used to have to create a fat library from the project, but the old videopreviewer didn't include the FFmpeg binary. The built framework could then be used with vendored_frameworks to load it via cocoapods.

If I create the Fat Library with DJIWidget like we used to, on pod install, we get the following error:

[!] The 'xxx-pod target has transitive dependencies that include static binaries

Another approach I took was to try to build the cocoapod from the project like so:

  s.source_files          = "DJIWidget/**/*.{h,m}"
  s.public_header_files   = "DJIWidget/**/*.h"

  s.pod_target_xcconfig   = { 'ENABLE_BITCODE' => 'NO' }

  s.vendored_frameworks  = "FFmpeg/FFmpeg.framework"

But then when I try to install the pod, the FFmpeg header files can't be found, adding the FFmpeg header files to public_header_files causes another error.

The documented way to add the code in https://developer.dji.com/mobile-sdk/documentation/ios-tutorials/index.html is not going to work for us

DJI have made the DJIWidget available through cocoapods now, https://github.com/dji-sdk/DJIWidget so this question is no longer relevant!

EDIT: For completeness, this is how they configured the podspec, specifying the headers using xconfig:

#
#  Be sure to run `pod spec lint DJI-SDK-iOS.podspec' to ensure this is a
#  valid spec and to remove all comments including this before submitting the spec.
#
#  To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |s|

  s.name         = "DJIWidget"
  s.version      = "1.0"
  s.summary      = "DJIWidget for DJI iOS Mobile SDK"
  s.homepage     = "https://github.com/dji-sdk/DJIWidget"
  s.license      = { :type => 'CUSTOM', :text => <<-LICENSE
****************************************************************************************************************************
DJIWidget is offered under MIT License (See below).
The MIT License (MIT)
Copyright (c) 2018 DJI
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
****************************************************************************************************************************
    LICENSE
  }

  s.author       = { "DJI SDK" => "dev@dji.com" }
  s.source       = { :git => 'https://github.com/dji-sdk/DJIWidget.git', :tag => s.version.to_s, :submodules => true }
  s.requires_arc = true
  s.platform     = :ios, '8.0'
  s.source_files = 'DJIWidget/**/*.{h,m,c}'
  s.ios.public_header_files = 'DJIWidget/**/*.{h}'
  s.ios.vendored_frameworks = 'FFmpeg/FFmpeg.framework'
  s.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Public/DJIWidget/FFmpeg/.."/**' }
  s.pod_target_xcconfig = {'ENABLE_BITCODE' => 'NO'}

end

Please update DJIWidget version to 1.1. https://github.com/dji-sdk/DJIWidget

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM