3

我有一个用objective c 制作的.framework,我使用cocoapods 制作了一个私有存储库,一切都运行良好。

但是现在......我不得不在我的 .framework 中添加 DFU 模式更新功能,为此我使用了这里提供的库 [ https://github.com/NordicSemiconductor/IOS-Pods-DFU-Library/blob/master/ README_OBJC.md][1]

为了能够将此库与可可一起使用,我必须使用 cocoapod install 将我的项目传递到工作区,并将依赖项放入我的目标 c 代码中。

#import <iOSDFULibrary/iOSDFULibrary-Swift.h>
@import iOSDFULibrary;

我的代码可以编译,看起来一切都很好。但是当我运行 pod spec lint 时,出现以下错误,

PruebaFramework $pod spec lint  DSFramework.podspec --allow-warnings  --use-libraries --verbose

    DSFramework (1.99.999) - Analyzing on iOS 8.0 platform.
  Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-App`: (``)

Fetching external sources
-> Fetching podspec for `DSFramework` from `/Applications/Programacion/PruebaFramework/DSFramework.podspec`

Resolving dependencies of 

Comparing resolved specification to the sandbox manifest
  A DSFramework
  A Zip
  A iOSDFULibrary

Downloading dependencies

-> Installing DSFramework (1.99.999)
  > Copying DSFramework from
  `/Users/administrador/Library/Caches/CocoaPods/Pods/External/DSFramework/035395061a29836d834f6bc0d067a91f-f3310`
  to `../../../../private/var/folders/lf/5hd49f8s24bd0k38_x5sgzt00000gp/T/CocoaPods/Lint/Pods/DSFramework`

-> Installing Zip (0.7.0)
  > Copying Zip from `/Users/administrador/Library/Caches/CocoaPods/Pods/Release/Zip/0.7.0-e3451` to
  `../../../../private/var/folders/lf/5hd49f8s24bd0k38_x5sgzt00000gp/T/CocoaPods/Lint/Pods/Zip`

-> Installing iOSDFULibrary (3.0.6)
  > Copying iOSDFULibrary from
  `/Users/administrador/Library/Caches/CocoaPods/Pods/Release/iOSDFULibrary/3.0.6-e9f78` to
  `../../../../private/var/folders/lf/5hd49f8s24bd0k38_x5sgzt00000gp/T/CocoaPods/Lint/Pods/iOSDFULibrary`
  - Running pre install hooks
 -> DSFramework (1.99.999)
    - WARN  | description: The description is shorter than the summary.
    - WARN  | url: There was a problem validating the URL https:xxxxxxxxx
    **- ERROR | [iOS] unknown: Encountered an unknown error (Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or target to opt into using it. The Swift Pods being used are: Zip and iOSDFULibrary**
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:450:in `block (2 levels) in verify_framework_usage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:445:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:445:in `block in verify_framework_usage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:442:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:442:in `verify_framework_usage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/validator.rb:486:in `block in install_pod'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/validator.rb:486:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/validator.rb:486:in `install_pod'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/validator.rb:306:in `block in perform_extensive_analysis'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/validator.rb:298:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/validator.rb:298:in `perform_extensive_analysis'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/validator.rb:79:in `validate'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/command/spec/lint.rb:67:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/command/spec/lint.rb:55:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/command/spec/lint.rb:55:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
) during validation.

Analyzed 1 podspec.

**[!] The spec did not pass validation, due to 1 error.
[!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a `.swift-version` file to set the version for your Pod. For example to use Swift 2.3, run: 
    `echo "2.3" > .swift-version`.**

/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/command/spec/lint.rb:84:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

我可以看到2个错误...

错误 | [iOS] 未知:遇到未知错误(用 Swift 编写的 Pod 只能集成为框架;将 use_frameworks! 添加到您的 Podfile 或目标以选择使用它。正在使用的 Swift Pod 是:Zip 和 iOSDFULibrary

[!] 由于 1 个错误,规范未通过验证。[!] Swift 项目的验证器默认使用 Swift 3.0,如果您使用不同版本的 swift,您可以使用 .swift-version 文件为您的 Pod 设置版本。例如,要使用 Swift 2.3,请运行:echo "2.3" > .swift-version。

我的规范

Pod::Spec.new do |s|
  s.name             = 'MyFramework'
  s.version          = '1.99.999'
  s.summary          = ''
  s.description      ='Framework'

  s.homepage         = 'https://xxxxxxxxxxxxxxxx'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'xxx' => 'xxxxxx@gmail.com' }
  s.source           = { :git => 'xxxxxxxxxxxxx', :tag =>s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '8.0'
  #s.source_files = 'Library/Classes/**/*'
  s.source_files = "MyFramework/*.{h,m}",'MyFramework/MyFrameworkIBeaconBLE.framework/Headers/*.h'

  # s.resource_bundles = {
  #   'Library' => ['Library/Assets/*.png']
  # }

  s.public_header_files = 'MyFramework/MyFrameworkIBeaconBLE.framework/Headers/*.h'
  #s.framework = ''
  s.ios.vendored_framework= 'MyFramework/MyFrameworkIBeaconBLE.framework'
  s.dependency 'iOSDFULibrary'
end

我的 pod 版本

pod --version
1.2.1
4

0 回答 0