【问题标题】:Converting to Xcode 9 - pod framework not showing up for conversion?转换为 Xcode 9 - pod 框架未显示转换?
【发布时间】:2018-02-12 05:12:03
【问题描述】:

好的,在这里让特定的 pod 在 Xcode 9 中工作有些困难。这是一个大问题,我不知道在这里做什么 - 问题是 https://github.com/tinypass/piano-sdk-for-ios 最后一次是用 Swift 3.1 和 Xcode 9 编写的导入 Swift 3.2。

将其他所有内容转换为 Swift 4 后出现此错误 -

因此,在查看其他答案后,我再次在 Xcode 8 中打开了该项目,因为据我了解,它可以转换为 Swift 3.2。然而,在去那里之后,当我去“转换为当前的 Swift 语法”时,它不会在你可以在菜单中检查的框架/事物下拉出这个特定的 pod。钢琴 OAuth 不存在。

我试图直接找到错误引用的 .swiftmodule,但是“模块文件夹”在我的项目中不可见 - 只有使用 finder 才能打开它,它是一堆随机字符。

我需要帮助。如何将此 pod 转换为 3.2 然后转换为 4?我尝试了 pod deintegrate 然后 pod install,在进入 9 之前我在 Xcode 8 中进行了清理,但这个 3.1 pod 没有任何效果。

PODFILE:

   # Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'Adventures In Design' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Adventures In Design

pod 'PianoOAuth', '~>2.0.1'
pod 'AudioPlayerManager'
pod 'FontAwesome.swift'
pod 'Parse'
pod 'ParseUI'

  target 'Adventures In DesignTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == 'Adventures In Design'
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '3.2'
            end
        end
    end

end

现在在另一个 pod 上得到这个:The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.

即使是 Swift 3

【问题讨论】:

  • pod 本身需要支持 Swift4,否则你将无法使用 Swift4 编译它,原因很明显。查看您提到的 pod 的 GitHub 页面,它尚不支持 Swift4,因此您将无法使用 Swift4 进行编译。
  • 对,这不是我要问的——我需要将它从 3.1 转换为 3.2。我怎么做?否则我无法在新的 Xcode 中运行我的整个程序

标签: xcode swift3 cocoapods swift4 xcode9-beta


【解决方案1】:

pod 本身需要支持 Swift 4 以便您能够将其编译为 Swift 4。至于 Swift 3.2,在 Xcode 9 beta 中有一个使用 Swift 3.2 编译 pod 的解决方法(代码复制自 GitHub issue上话题):

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == '<insert target name of your pod here>'
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '3.2'
            end
        end
    end
end

但是,如果 pod 包含一些使用 Swift 3.1 编译的预构建二进制文件,则您无法更新 pod,您需要等待项目的开发人员将其更新到 Swift 3.2。

【讨论】:

  • 你把它放在你的 pod 文件的什么地方了?我用我的 pod 文件的样子更新了我的问题,并且在 pod install 之后仍然无法正常工作
  • 在所有其他 do 块都以 end 完成后,它应该转到 podfile 的最后。
  • 好的,这里对 pod 语法有点新意。你能检查我的答案吗?
  • 仍然不正确。检查CocoaPods Guides - Podfile 页面以查看post_install 部分的位置。您的最后一个 end 应该在 post_install 之前。
  • 知道了。感谢您帮助我解决这个问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多