diachedelic / capacitor-blob-writer

Capacitor plugin to write binary data to the filesystem
MIT License
132 stars 17 forks source link

Issue with iOS min deployment target and Capacitor #70

Closed mrobst closed 1 year ago

mrobst commented 1 year ago

Hi, I'm having problems building on both AppCenter and locally (XCode). I think in both cases this is because the min deployment target for Capacitor 5.5.1 is 13.0 but for capacitor-blob-writer the target is 12.0

Microsoft App Center: (XCode 14.1) says:

The following build commands failed:
    SwiftCompile normal arm64 Compiling\ Plugin.swift /Users/runner/work/1/s/node_modules/capacitor-blob-writer/ios/Plugin/Plugin.swift (in target 'CapacitorBlobWriter' from project 'Pods')
    CompileSwift normal arm64 /Users/runner/work/1/s/node_modules/capacitor-blob-writer/ios/Plugin/Plugin.swift (in target 'CapacitorBlobWriter' from project 'Pods')

(2 failures)

Local XCode 15 says:

CapacitorBlobWriter
  /Users/mrobst/bin/ScafolSurveyApp/node_modules/capacitor-blob-writer/ios/Plugin/Plugin.swift
      /Users/mrobst/bin/ScafolSurveyApp/node_modules/capacitor-blob-writer/ios/Plugin/Plugin.swift:2:8 Compiling for iOS 12.0, but module 'Capacitor' has a minimum deployment target of iOS 13.0: /Users/mrobst/Library/Developer/Xcode/DerivedData/App-gwhpvtiasrmnlkcmegcrzzbrccvj/Index.noindex/Build/Products/QA Debug-iphonesimulator/Capacitor/Capacitor.framework/Modules/Capacitor.swiftmodule/arm64-apple-ios-simulator.swiftmodule

If I change the min deployment target to 13.0 on the local XCode the app builds OK but I don't see anyway of doing this for the AppCenter build?? I already have

platform :ios, '13.0'
use_frameworks!

in my Podfile.

Capacitor / Plugin Versions: |── @capacitor/android@5.5.1 ├── @capacitor/app@5.0.6 ├── @capacitor/camera@5.0.7 ├── @capacitor/cli@5.5.1 ├── @capacitor/core@5.5.1 ├── @capacitor/device@5.0.6 ├── @capacitor/filesystem@5.1.4 ├── @capacitor/ios@5.5.1 ├── @capacitor/network@5.0.6 ├── @capacitor/preferences@5.0.6 ├── @capacitor/splash-screen@5.0.6 ├── @capawesome/capacitor-app-update@5.0.1 ├── capacitor-blob-writer@1.1.14 ├── capacitor-ios-autofill-save-password@1.1.5

Thanks! Marcus

diachedelic commented 1 year ago

Your Podfile needs to call assertDeploymentTarget, like this: https://github.com/ionic-team/capacitor/blob/40d62cbce950c2f3972764fe134cc37f2343f33d/ios-pods-template/App/Podfile#L22.

mrobst commented 1 year ago

Thanks for the quick reply. assertDeploymentTarget is broken in XCode 15 so I replaced it with similar code from here: https://github.com/CocoaPods/CocoaPods/issues/12012

post_install do |installer|
  # assertDeploymentTarget(installer)
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|

            if config.base_configuration_reference
        xcconfig_path = config.base_configuration_reference.real_path
        xcconfig = File.read(xcconfig_path)
        xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
        File.open(xcconfig_path, "w") { |file| file << xcconfig_mod } 
      end
end
end
end

That code isn't letting the capacitor-blob-writer build :-(

diachedelic commented 1 year ago

https://github.com/ionic-team/capacitor/blob/40d62cbce950c2f3972764fe134cc37f2343f33d/ios/scripts/pods_helpers.rb#L4