ClaySolutions / ClaySDK

This SDK for iOS contains the most up-to-date frameworks for integrating Mobile Key technology into your own iOS applications.
https://saltoks.com/developers/connect/mobile-sdk-introduction/
MIT License
1 stars 1 forks source link

ClaySDK 1.11.1 and swift 5.8 #16

Open dgalitsyn opened 1 year ago

dgalitsyn commented 1 year ago

Hi,

Trying to import the SDK into my project (xcode 14.3) and I am getting this error: Failed to build module 'ClaySDK'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)', while this compiler is 'Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)'). Please select a toolchain which matches the SDK.

I am not an ios dev, so not sure how to proceed from here. I have tried setting the Build Libraries for Distribution = YES, however this break other libraries (like Stripe and a couple of others) however it fixes this problem. So im kind of stuck. Is it possible to compile with swift 5.8?

Cheers, Denis.

dgalitsyn commented 1 year ago

Hi @jakov-clay, any update on this please?

jakov-clay commented 1 year ago

@dgalitsyn I don't have same issue. What might help you is adding this to your Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if ['ClaySDK', 'VirgilCrypto', 'VirgilCryptoFoundation', 'VirgilSDK'].include? target.name
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
      end
  end
end

If that does not help let's see if we can do something else. There is a new version of SDK distributed via Gitlab but it requires authentication. If this does not help we can try to move you to that new version

dgalitsyn commented 1 year ago

Hi,

Thanks for you reply. Just tried this solution and I still get the same error, actually I get an additional error regards Virgil Crypto: Compiling for iOS 11.0, but module 'VirgilCrypto' has a minimum deployment target of iOS 13.0

I've installed the pod via pod install, not sure how to get it from gitlab (i am assuming the podfile pulls from github), but willing to try this solution.

Please let me know.

Regards, Denis.

jakov-clay commented 1 year ago

Is your minimum deployment target 11 or 13?

installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' # or 13.0 depending on your project
    end
end

can you try setting it like this if you support iOS 13. For moving to Gitlab distribution you need to contact Salto KS support, they will give you credentials and wiki pages.

dgalitsyn commented 1 year ago

Our minimum target is ios13. I think we have tried the BUILD_LIBRARY_FOR_DISTRIBUTION = YES previously and it made the project not compile at all with countless other errors popping up.

Thank you for your help, I will email saltoks support and take it from there.

dgalitsyn commented 1 year ago

@jakov-clay I raised an issue on gitlab, could you take a look. I think the problem is with the virgil libraries and xcode 14.3. Can you see if you can replicate the issues please? Thanks

jakov-clay commented 1 year ago

@dgalitsyn I'll take a look, sorry for waiting

TudorAxinte commented 1 year ago

Ran into the same issue as well, and the config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' fix isn't cutting it for us. Are there any news on it? Flutter app here, ClaySDK (1.11.1). Flutter always wants to use Swift 5.8 for some reason and can't get rid of Swift Compiler Error (Xcode): Failed to build module 'ClaySDK'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)', while this compiler is 'Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)'). Please select a toolchain which matches the SDK.

`import UIKit import Flutter import ClaySDK import SaltoJustINMobileSDK

@UIApplicationMain @objc class AppDelegate: FlutterAppDelegate {

private var deviceUID: String {
    UIDevice.current.identifierForVendor?.uuidString ?? UUID().uuidString
}

private lazy var claySDK: ClaySDK = {
    let apiKey = "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8rTg+rB+NPmE1FI4aJZHK2zjptyx3HkhTOrTEKylaGc9Sh2aPd+7ahyn9PZcEl6QnA4C7Okg2Kll00UCPjV0hQ=="
    ClaySDK(installationUID: deviceUID, apiKey: apikEY, delegate: self)
}()

override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    // Obtain FlutterViewController reference
    let controller : FlutterViewController = window?.rootViewController as! FlutterViewController

    // Create MethodChannel
    let clayChannel = FlutterMethodChannel(name: "com.paragon/ClaySDK", binaryMessenger: controller.binaryMessenger)

    clayChannel.setMethodCallHandler({
        (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
        switch call.method {
            case "hello":
            let publicKey = self.claySDK.getPublicKey()
            result(publicKey)

            default:
                result(FlutterMethodNotImplemented)
        }
    })

    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

}

`

jakov-clay commented 1 year ago

@TudorAxinte to have all the latest update please move to ClaySDK 2. You need to contact support@my-clay.com for auth token, docs can be found here: https://gitlab.com/claysolutions/public/clay-sdk/-/wikis/home