2

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

blue
  • 7,175
  • 16
  • 81
  • 179
  • The pod itself needs to support Swift4, otherwise you won't be able to compile it using Swift4 for obvious reasons. Looking at the GitHub page of the pod you mentioned, it doesn't yet support Swift4, so you won't be able to compile it using Swift4. – Dávid Pásztor Sep 04 '17 at 09:45
  • Right that's not what I'm asking - I need to convert it from 3.1 to 3.2. How do I do that? Or else I can't run my whole program in the new Xcode – blue Sep 04 '17 at 11:33

1 Answers1

1

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.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
  • Where did you put that in your pod file? I updated my question with what my pod file looks like and after doing pod install still not working – blue Sep 04 '17 at 15:41
  • It should go to the very end of your podfile after all other `do` blocks are finished with an `end`. – Dávid Pásztor Sep 04 '17 at 15:53
  • Ok, right a little new to pod syntax here. Can you check my answer? – blue Sep 04 '17 at 15:54
  • Still not correct. Check the [CocoaPods Guides - Podfile](https://guides.cocoapods.org/syntax/podfile.html#podfile) page to see where the `post_install` part should go. Your very last `end` should be before `post_install`. – Dávid Pásztor Sep 04 '17 at 15:58
  • when the syntax is right will it say something different in terminal when I do pod install? I updated my answer - is it right now? – blue Sep 04 '17 at 16:00
  • Yes, it seems to be correct now. No, you won't see anything different when creating the pods, however, your project should now be correctly compiled using Swift 3.2 for `PianoOAuth`. – Dávid Pásztor Sep 04 '17 at 16:07
  • Never mind - I have the same error again. Whats wrong here? – blue Sep 04 '17 at 16:09
  • Have you tried adding your pods to a new empty] project to see if the error is present there as well? – Dávid Pásztor Sep 04 '17 at 16:13
  • I will do that - could it be that in the post install bit I target the whole target and not the PianoOAuth pod specifically? – blue Sep 04 '17 at 16:15
  • Yes, since `target.name` won't match your project name there, it needs to be `PianoOAuth` as it was in your first edit. Btw if the specific project has some prebuilt binaries embedded that were compiled using Swift3.1, you won't be able to manually update it to Swift3.2, the developer of the project needs to update it in that case. – Dávid Pásztor Sep 04 '17 at 16:18
  • Am I screwed then? Because even doing that does nothing - it says it was compiled in Swift 3.1. When Xcode 9 comes out will I just have run both versions until the pod is (if it is ever) updated? – blue Sep 04 '17 at 16:21
  • Yes, it seems like you can't use this pod until it is updated to at least Swift3.2. You should definitely open an issue under their GitHub project to speed up the process in the meantime. Yes, since Xcode9 can only compile Swift3.2, it seems like you will need to be using Xcode8 and Xcode9 until the pod is updated. – Dávid Pásztor Sep 04 '17 at 16:25
  • 1
    Got it. Thanks for helping me figure that out. – blue Sep 04 '17 at 16:26