【问题标题】:Xcode Swift CocoaPods pod spec lint Fails on Embed Pods FrameworksXcode Swift CocoaPods pod spec lint 在 Embed Pods 框架上失败
【发布时间】:2019-03-18 14:04:38
【问题描述】:

我在尝试运行 pod spec lint --verbose 时遇到以下错误:

sent 1312397 bytes  received 106 bytes  2625006.00 bytes/sec
total size is 1311832  speedup is 1.00
/var/folders/3d/v0m_90ty4mg1opbynpnjjvzh2010gm/T/CocoaPods-Lint-20181015-62030-oljqd-MySwiftPackage/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh: line 104: EXPANDED_CODE_SIGN_IDENTITY: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

    ** BUILD FAILED **


    The following build commands failed:
        PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/myuser/Library/Developer/Xcode/DerivedData/App-loplmnuztwibrzfqgadqoxucytrz/Build/Intermediates.noindex/App.build/Release/App.build/Script-09EB8340PON5K18DNW0C63DQ.sh
    (1 failure)
   Testing with `xcodebuild`. 
 -> MySwiftPackage (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - WARN  | description: The description is shorter than the summary.
    - WARN  | url: The URL (https://github.com/fishcharlie/MySwiftPackage) is not reachable.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Planning build
    - NOTE  | xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file. (in target 'App')
    - WARN  | xcodebuild:  MySwiftPackage/MySwiftPackage/ViewControllers/Shared/MyFirstViewController.swift:102:37: warning: conditional cast from 'UIViewController' to 'MyViewController' (aka 'UIViewController') always succeeds
    - WARN  | xcodebuild:  MySwiftPackage/MySwiftPackage/ViewControllers/Shared/MySecondViewController.swift:145:37: warning: conditional cast from 'UIViewController' to 'MyViewController' (aka 'UIViewController') always succeeds
    - ERROR | [OSX] xcodebuild: Returned an unsuccessful exit code.

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 1 error and 5 warnings.

我知道我有一些可以清理的警告。但我得到的只有一个错误,即- ERROR | [OSX] xcodebuild: Returned an unsuccessful exit code.。除此之外,它还说Embed Pods Frameworks 是失败的原因。

不确定如何调试它,因为我可以在 Xcode 中构建和运行示例项目。

下面我也附上了我的 Podspec。

Pod::Spec.new do |s|
  s.name             = 'MySwiftPackage'
  s.version          = '0.1.0'
  s.summary          = 'A short description of MySwiftPackage.'

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'https://github.com/fishcharlie/MySwiftPackage'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'fishcharlie' => 'fishcharlie.code@gmail.com' }
  s.source           = { :git => 'https://github.com/fishcharlie/MySwiftPackage.git', :tag => s.version.to_s }
  s.social_media_url = 'https://twitter.com/char_fish'

  s.ios.deployment_target = '9.0'
  s.osx.deployment_target = '10.11'
  s.swift_version = '4.2'

  s.source_files = 'MySwiftPackage/Classes/**/*', 'MySwiftPackage/ViewControllers/Shared/**/*'
  s.ios.source_files = 'MySwiftPackage/ViewControllers/iOS/**/*'
  s.osx.source_files = 'MySwiftPackage/ViewControllers/macOS/**/*'
  s.resources = 'MySwiftPackage/Assets/**/*.{ttf,xcassets}'

  s.dependency 'Alamofire', '4.7.3'
  s.dependency 'Bond', '6.10.2'
  s.ios.dependency '1PasswordExtension', '1.8.5'
end

关于如何修复/调试此问题的任何想法?

【问题讨论】:

  • 你的 cocoapod 版本是多少?看起来他们在 pr github.com/CocoaPods/CocoaPods/pull/7720 中为 xcode 10 修复了这个问题,您可以尝试升级到 1.6.0
  • @JohnOttenlips 我相信 1.6.0 处于测试阶段,并且不希望升级到测试版本。我正在运行 1.5.3 版。
  • 你可以试试 Xcode 9.4
  • 只是一个建议,先解决警告。我遇到了同样的问题,当我添加s.source 中提到的摘要、描述和 URL(有效的 git url)时。我能够成功编译

标签: ios swift xcode macos cocoapods


【解决方案1】:

错误应该是关于 line 104: EXPANDED_CODE_SIGN_IDENTITY: unbound variable

解决方案(如Issue 7708 on github/Cocoapods 中所述)应将以下用户定义的设置添加到项目中:

EXPANDED_CODE_SIGN_IDENTITY="-"
EXPANDED_CODE_SIGN_IDENTITY_NAME="-"`

【讨论】:

  • 我把这些放在哪里?我很确定 CocoaPods 会为我尝试运行的命令创建一个全新的工作区。
  • 您可以创建一个xxx.xcconfig文件,第一行#include "./Pods/Pods.xcconfig"并在Xcode项目设置how to add custom environment variables...中更改配置设置文件
【解决方案2】:

尝试添加标志--no-clean。此标志使 lint 离开构建目录 完好无损以供检查 因此您可以在可能更熟悉的工作区中调试构建失败并为您提供更多信息。

看起来他们在 github.com/CocoaPods/CocoaPods/pull/7720 中为 xcode 10 修复了此问题,您可以尝试升级到 1.6.0,或将 xcode 降级到 9.4。

【讨论】:

  • 试过了,然后在 Xcode 中打开了工作区并构建它没有错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-10-02
  • 2018-03-05
  • 1970-01-01
  • 1970-01-01
  • 2021-02-04
  • 1970-01-01
  • 2019-12-31
相关资源
最近更新 更多