filipealva / PickerView

🔸 A customizable alternative to UIPickerView in Swift.
MIT License
527 stars 92 forks source link

[QUESTION] Errors with version 0.4.0 #52

Closed neilt closed 5 years ago

neilt commented 5 years ago

After updating my project to the 0.4.0 version I get the following errors after cleaning build folder and building:

  1. header "PickerView-Swift.h" not found. This file name is not referenced in my project. Also indicates: Could not build Objective-C module 'PickerView'. Which seems to be related to the header file not found. Note that my project is Swift 4.2 not Objc, except for one pod which is objc.

  2. Showing All Messages Pods/PickerView/Pod/Classes/PickerView.swift:397:76: 'orientationDidChangeNotification' has been renamed to 'NSNotification.Name.UIDeviceOrientationDidChange'

  3. Pods/PickerView/Pod/Classes/PickerView.swift:399:76: 'orientationDidChangeNotification' has been renamed to 'NSNotification.Name.UIDeviceOrientationDidChange'

Xcode Version 10.0 (10A254a). pod version 1.5.3

Update all pods Analyzing dependencies Downloading dependencies Installing AMPopTip 3.5.0 (was 3.4.0 and source changed to https://github.com/CocoaPods/Specs.git from https://github.com/cocoapods/specs.git) Using CSV.swift (2.2.1) Installing DeviceGuru 5.0.0 (was 4.0.4 and source changed to https://github.com/CocoaPods/Specs.git from https://github.com/cocoapods/specs.git) Installing Google-Mobile-Ads-SDK 7.35.1 (was 7.33.1 and source changed to https://github.com/CocoaPods/Specs.git from https://github.com/cocoapods/specs.git) Using ObjcExceptionBridging (1.0.1) Installing PickerView 0.4.0 (was 0.3.4 and source changed to https://github.com/CocoaPods/Specs.git from https://github.com/cocoapods/specs.git) Using SVProgressHUD (2.2.5) Using SwiftyStoreKit (0.13.3) Using TPInAppReceipt (1.2.1) Using XCGLogger (6.1.0) Generating Pods project Integrating client projects Sending stats Pod installation complete! There are 9 dependencies from the Podfile and 10 total pods installed.

filipealva commented 5 years ago

Hi @neilt,

This is happening because you are installing libraries built with different Swift versions.

Take a look at this issue in the CocoaPods repo and at this blog post and you'll have an idea of what's going on.

TL;DR you'll need to add a post installer script to your Podfile in order to support multiple Swift version dependencies. You'll end up with something like that at the end of your Podfile:

post_install do |installer|
  swift42Targets = ['PickerView']
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.1'
    end
    if swift42Targets.include? target.name
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.2'
      end
    end
  end
end

Please note that the script for your specific case might change based on the versions of Swift that your dependencies are using.