I'm trying to add a MLKit for iOS with cocoa pods,...
# multiplatform
r
I'm trying to add a MLKit for iOS with cocoa pods, but I getting an error `Specs satisfying the
GoogleMLKit/BarcodeScanning (= 3.2.0)
dependency were found, but they required a higher minimum deployment target.`
a
This is probably better in the iOS channel as it is specifically an iOS error. In your Podfile and XCode Project specifically, you probably have an older version of iOS specified as the minimum deployment target. You can update the version there so the iOS builds for later versions. This helps quite a bit as you get into 15 and 16 versions in particular. Here's a good place to start when choosing the right version for your app: https://iosref.com/ios-usage Setting Deployment Target in XCode: https://stackoverflow.com/questions/75201881/kmm-how-to-set-ios-deployment-target
r
Thank's, I'm at 15.3, tested with 17.0, still not enough
a
Did you change the XCode file AND the PodFile if your using cocoapods?
In the PodFile inside the iOS project, you may have something like this:
I think MLKit also only works on 64bit devices
r
Where is this pod file ? I don't know anything about iOS stuff sorry
a
it should be in the root of the ios project folder
Is this a multiplatform library or app?
r
App
I don't see it, maybe my conf is bad
a
For me and this project has been around a while, it is here:
The older projects can be a bit confusing with "iosApp" folders
Notice the lowercase f on Podfile if you are searching for it
r
It's a fresh project, I just added cocaopods. So maybe I need to launch something before
a
I would think this has been handled in newer projects, but I can't say for sure
It may be worth checking out the 32bit support side as well
I suspect that was default, but just my own paranoia since MLKit does have note about it
iOS projects in general (having nothing to do with multiplatform) are a pain to configure between XCode, plist, pod, and swift packages. I always seem to get caught in some battle making XCode happy before I can work on them after a while.
How did you add the pod to your project?
r
Copy code
kotlin {
...
    cocoapods {
        version = "1.0"
        summary = "Some description for a Kotlin/Native module"
        homepage = "Link to a Kotlin/Native module homepage"

        framework {
            baseName = "MyFramework"
        }

        xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
        xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE

        pod("GoogleMLKit/BarcodeScanning") {
            version = "3.2.0"
        }
    }
}
a
Ahhhh...the new gradle dsl for it
That's generating a podfile for you
r
It generate a
.podspec
I was missing
ios.deploymentTarget = "16.0"
a
Confirmed working now?
r
Yeah, I have access to the library, thank's
But maybe the doc is missing some info
a
Yea, the gradle dsl for this is a big improvement if it covers everything well. Sorry I wasn't more help with the newer format, but I'm glad you got where you needed to go! We've done quite a bit of barcode scanning so have fun!
🙌 1
s
Working on the exact same thing as you! - Did you end up modifying the spec file manually, or did you get it all working just using the Gradle DSL? For example, where in Gradle does one add this line?
Copy code
ios.deploymentTarget = "16.0"
r
cocoapods { ios.deploymentTarget = "16.0" }
s
Thanks. Did you ever get these errors? - If so, how did you resolve them:
Copy code
Failed to generate cinterop for :composeApp:cinteropBarcodeScanningIosX64:
Failed to generate cinterop for :composeApp:cinteropBarcodeScanningIosArm64
# repeat for other architectures
Giving these errors:
Copy code
:composeApp:iosArm64Main: cinterop file: composeApp/build/classes/kotlin/iosArm64/main/cinterop/composeApp-cinterop-BarcodeScanning.klib does not exist
# repeat for other architectures
(maybe you can make your barcode integration available on GitHub? - 🙏)
b
@Samuel I am facing same error. Did you found any solution?
415 Views