jibon57 / nativescript-mediafilepicker

A complete file picker solution for NativeScript
Apache License 2.0
51 stars 36 forks source link

IOS Build Failed (Xcode >= 11.3) #106

Closed standevo closed 4 years ago

standevo commented 4 years ago

Hi, I have a problem with a IOS when I try to build my application after updating the Xcode to the version 11.3 and now 11.4. It's related to DKImagePickerController, bunch of Swift compiler errors.

For example:

'pngData()' has been renamed to 'UIImagePNGRepresentation(_:)'
...
'jpegData(compressionQuality:)' has been renamed to 'UIImageJPEGRepresentation(_:_:)'
...
etc
jibon57 commented 4 years ago

It's native library related error. You can open issue in native library repo

standevo commented 4 years ago

@jibon57, Thx the author of native library comes here with a fix. There is a way to force the Swift version with the plugin directly? Or it should be done inside native library?

jibon57 commented 4 years ago

@Stanteq thank you. Will you please try to follow this article: https://medium.com/@championswimmer/setting-swift-version-in-nativescript-6ece09112a46

post_install do |installer|  
    installer.pods_project.targets.each do |target|    
        target.build_configurations.each do |config|      
            config.build_settings['SWIFT_VERSION'] = '5.0'     
        end   
    end
end
jibon57 commented 4 years ago

I think it's better to set DKImagePickerController for swift 5 only.

pre_install do |installer|
    installer.analysis_result.specifications.each do |s|
        if s.name == 'DKImagePickerController'
            s.swift_version = '5.0'
        end
    end
end
standevo commented 4 years ago

@jibon57, thank you for the guidance.

This sets the desired version for all pods (but in my case breaks other ones which are required a different version)

post_install do |installer|  
  installer.pods_project.targets.each do |target|    
      target.build_configurations.each do |config|      
          config.build_settings['SWIFT_VERSION'] = '5.0'     
      end   
  end
end

This has no effect. The swift version remains unchanged

pre_install do |installer|
    installer.analysis_result.specifications.each do |s|
        if s.name == 'DKImagePickerController'
            s.swift_version = '5.0'
        end
    end
end

I combined these two solutions and the working one is this:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'DKImagePickerController'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '5.0'
      end
    end
  end
end

article