【问题标题】:How can we use DJIWidget in a cocoapod framework我们如何在 cocoapod 框架中使用 DJIWidget
【发布时间】:2018-09-21 09:58:38
【问题描述】:

我正在努力尝试将DJIWidget 包含在我们的 cocoapod 开发环境中。

我们有一个带有 DJI 源的 cocoapod 框架,我们希望在其中包含 DJIWidget 作为使用 DJIVideoPreviewer 的依赖项,但我尝试的每一种方法都无法让它工作,主要问题是FFmpeg 静态二进制文件。

使用旧的 VideoPreviewer,我们过去必须从项目中创建一个胖库,但旧的 videopreviewer 不包含 FFmpeg 二进制文件。然后可以将构建的框架与 vendored_frameworks 一起使用,以通过 cocoapods 加载它。

如果我像以前一样使用 DJIWidget 创建 Fat Library,在 pod install 时,我们会收到以下错误:

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

我采取的另一种方法是尝试从项目中构建 cocoapod,如下所示:

  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"

但是当我尝试安装 pod 时,找不到 FFmpeg 头文件,将 FFmpeg 头文件添加到 public_header_files 会导致另一个错误。

https://developer.dji.com/mobile-sdk/documentation/ios-tutorials/index.html 中添加代码的记录方法对我们不起作用

【问题讨论】:

  • 您能描述一下将 FFmpeg 标头添加到 public_header_files 时遇到的错误吗?
  • 当我运行 pod lib lint 时,我得到“模式包含未在 source_files 中列出的头文件”,无论如何尝试安装 pod,它再次在项目中找不到 FFmpeg 头文件它无法构建

标签: ios cocoapods dji-sdk


【解决方案1】:

DJI 现已通过 cocoapods 提供 DJIWidget,https://github.com/dji-sdk/DJIWidget 所以这个问题不再相关!

编辑:为了完整起见,这是他们配置 podspec 的方式,使用 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

【讨论】:

    【解决方案2】:

    请将DJIWidget 版本更新到 1.1。 https://github.com/dji-sdk/DJIWidget

    【讨论】:

      猜你喜欢
      • 2016-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-07
      • 2021-08-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多