Search code examples
xcodeswift3cocoapodsswift4xcode9-beta

Converting to Xcode 9 - pod framework not showing up for conversion?


Ok, having some difficulty here getting a specific pod to work in Xcode 9. It's a large problem and I don't know what to do here - the issue is https://github.com/tinypass/piano-sdk-for-ios was last written in Swift 3.1 and Xcode 9 only imports Swift 3.2.

I get this error after converting everything else to Swift 4 -

enter image description here

So after looking at other answers I opened the project in Xcode 8 again because from what I UNDERSTAND that can convert to Swift 3.2. After going there however, when I go "Convert to current Swift syntax" it does not pull up this specific pod under frameworks/ things you can check in the menu. Piano OAuth is not there.

I tried to find the .swiftmodule the error references directly however the "Modules folder" is not visible in my project - only using finder can I open it, and its a bunch of random characters.

I need help. How can I convert this pod to 3.2 then to 4? I tried pod deintegrate then pod install, and I cleaned in Xcode 8 before going to 9 and nothing is working with this 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

Now getting this on another 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.

even though it is Swift 3


Solution

  • The pod itself needs to support Swift 4 in order for you to be able to compile it to Swift 4. As for Swift 3.2, there is a workaround for compiling pods using Swift 3.2 in Xcode 9 beta (code copied from a GitHub issue on the topic):

    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
    

    However, if the pod contains some prebuilt binaries, that were compiled using Swift 3.1, you cannot do anything to update the pod, you need to wait for the developer of the project to update it to Swift 3.2.