Module minimum deployment target catcher

Viewed 904

my Swift App need to support iOS9, but now I'm using a module that needs 10.0 support.. I can't deploy/build the App anymore.

Module file's minimum deployment target is ios10.0 v10.0

Because I defined 9.0 as the deployment target.

It's because of a use ModuleName on top of a Swift file. How can I catch this? I already made the code that the Module is only available on iOS 10 and up:

@available(iOS 10, *)

But still get the error because of the use on top of the Swift-file.

1 Answers

You don't mention how you are importing the module that you are using, so I'm going to discuss a couple of ways.

  • I assume that you are not including the source code in your project, otherwise you wouldn't have a problem.
  • I also assume you mean import where you say use.
  • If there is a reason for requiring 10.0, then you will have to edit the code to annotate the 10.0 methods using @available(iOS 10, *) and provide fallbacks

If you have a separate target in your project that is building a framework, just go into that target and in General > Deployment Info and set the deployment target to 9.0.

If you are using Cocoapods or some other dependency manager, you can still do the above, but it will get wiped out on regeneration. If you are using cocoapods you can use a post install hook in your podfile to accomplish the above:

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if ['RevealingTableViewCell'].include? target.name
        target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
        end
      end
    end
  end

Note again that this will not help you if there's a good reason the module has a minimum deployment target.

I don't know about other package managers but hopefully this will get you on the right track. Also, note that iOS 9 usage numbers are falling and dropping support for it may be an option as well.

Related