razorpay / razorpay-flutter

Razorpay Flutter Plugin
MIT License
106 stars 144 forks source link

Error: module compiled with Swift 5.4.2 cannot be imported by the Swift 5.5.1 compiler #205

Open jigarfumakiya opened 2 years ago

jigarfumakiya commented 2 years ago

Hello There

I am trying to integrate this SDK into my app. I have done all the steps and still giving the error.

Description

I have updated the pod file as your docs. And still says error: module compiled with Swift 5.4.2 cannot be imported by the Swift 5.5.1 compiler:

I have tried the below solution

Flutter Version :

Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18116933e7 (4 weeks ago) • 2021-10-15 10:46:35 -0700
Engine • revision d3ea636dc5
Tools • Dart 2.14.4

Xcode Version :

Version 13.1 (13A1030d)

Cocoapod Version :

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Add dependency to your project
  2. Run project in Xcode 13.

Expected Results

It should run without error

Logs

Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                            9.3s
Failed to build iOS app
Error output from Xcode build:
↳
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
    { platform:iOS Simulator, id:5D396B2A-1FE9-4F4F-9E6C-A9E7EA8E81EA, OS:15.0, name:iPhone 8 }
    { platform:iOS Simulator, id:1A46885D-FBAD-41AA-8487-CE3F8054022C, OS:15.0, name:iPhone 8 Plus }
    { platform:iOS Simulator, id:9D37E9D9-CCAA-470C-9E43-E276D553B25C, OS:15.0, name:iPhone 11 }
    { platform:iOS Simulator, id:731E6123-E697-4043-B13A-B643B4C42EA1, OS:15.0, name:iPhone 11 Pro }
    { platform:iOS Simulator, id:2F83B93C-B7A9-4C27-90EB-453FF6707411, OS:15.0, name:iPhone 11 Pro Max }
    { platform:iOS Simulator, id:24D24521-DAD5-4061-BDB4-FBCF3A9DA661, OS:15.0, name:iPhone 12 }
    { platform:iOS Simulator, id:419EB96D-8639-45D2-BD4D-631756087B4E, OS:15.0, name:iPhone 12 Pro }
    { platform:iOS Simulator, id:E7FFA83C-D286-49E1-B205-ACEF0F4DCA3F, OS:15.0, name:iPhone 12 Pro Max }
    { platform:iOS Simulator, id:CF2D4DCB-0004-46BA-8F5C-E677653150E1, OS:15.0, name:iPhone 12 mini }
    { platform:iOS Simulator, id:7E3BDE65-86BE-430F-B8C3-0D029A510B3E, OS:15.0, name:iPhone 13 }
    { platform:iOS Simulator, id:ACE6ED57-649A-4DC1-8849-77E5F7809E10, OS:15.0, name:iPhone 13 Pro }
    { platform:iOS Simulator, id:A502BDD9-2EF3-446E-A0F5-8F0968CEB712, OS:15.0, name:iPhone 13 Pro Max }
    { platform:iOS Simulator, id:407709A3-6F09-4684-9FBA-D49059119FAA, OS:15.0, name:iPhone 13 mini }
    { platform:iOS Simulator, id:EBCDDE0A-8F6E-466B-90C6-394C1C35E490, OS:15.0, name:iPhone SE (2nd generation) }
    { platform:iOS Simulator, id:DC5061EF-AB29-4C8D-9B6B-75D7EC5649F2, OS:15.0, name:iPod touch (7th generation) }
    { platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:00008103-001E25393ADA001E }
    { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
    { platform:iOS Simulator, id:21846797-56F0-4227-981C-58BA9BCD6ED0, OS:15.0, name:iPad (9th generation) }
    { platform:iOS Simulator, id:F02DFBA3-03E1-4D6B-BB95-1EB7325B0C5A, OS:15.0, name:iPad Air (4th generation) }
    { platform:iOS Simulator, id:584677EB-CE29-4C55-AD41-E947D30C966D, OS:15.0, name:iPad Pro (9.7-inch) }
    { platform:iOS Simulator, id:2CAE0F31-EFC9-4BA9-90EC-598663FACA52, OS:15.0, name:iPad Pro (11-inch) (3rd generation) }
    { platform:iOS Simulator, id:D18A0CFA-9990-4B8A-A2F6-7E9D302C48D5, OS:15.0, name:iPad Pro (12.9-inch) (5th generation) }
    { platform:iOS Simulator, id:77740F0D-B80E-47EA-A25F-DDD0B8123330, OS:15.0, name:iPad mini (6th generation) }
    ** BUILD FAILED **

Xcode's output:
↳
    <unknown>:0: error: unable to load standard library for target 'arm64-apple-ios10.0'
    /Users/jigafumakiya/Documents/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/razorpay_flutter-1.2.7/ios/Classes/RazorpayDelegate.swift:2:8: error: module compiled with Swift 5.4.2 cannot be imported by the Swift 5.5.1 compiler: /Users/jigafumakiya/Documents/Jigar/Carselona/carselona_customer_app_jigar/ios/Pods/razorpay-pod/Pod/Razorpay.framework/Modules/Razorpay.swiftmodule/arm64.swiftmodule
    import Razorpay
           ^
    <unknown>:0: error: unable to load standard library for target 'arm64-apple-ios10.0'
    /Users/jigafumakiya/Documents/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/razorpay_flutter-1.2.7/ios/Classes/RazorpayDelegate.swift:2:8: error: module compiled with Swift 5.4.2 cannot be imported by the Swift 5.5.1 compiler: /Users/jigafumakiya/Documents/Jigar/Carselona/carselona_customer_app_jigar/ios/Pods/razorpay-pod/Pod/Razorpay.framework/Modules/Razorpay.swiftmodule/arm64.swiftmodule
    import Razorpay

Let me know if you need anything else.

manisics commented 2 years ago

I am also facing the same issue. did you find any solution on this? @jigarfumakiya jigarfumakiya

withniyaz commented 2 years ago

Facing the same issue, Please anyone has a solution for this?

jigarfumakiya commented 2 years ago

No, I have tried multiple workaround nothing works. No response from RazorPay Team.

jigarfumakiya commented 2 years ago

199 This might help.

withniyaz commented 2 years ago

Cant work on projects with Razorpay cause of this issue. authors, please look into this issue. The last working Xcode Version was 12.5.1 but cant downgrade to that since it will only work on Mac OS Big Sur. Again have to downgrade OS too.

jigarfumakiya commented 2 years ago

Yes, Have the same issue.

withniyaz commented 2 years ago

Got a workaround @jigarfumakiya

jigarfumakiya commented 2 years ago

What is the workaround? @niyasmhdth Downgrade flutter version ?

withniyaz commented 2 years ago
Screenshot 2021-11-22 at 4 50 05 PM

Build Libraries for distribution - Turn. it to no.

Screenshot 2021-11-22 at 4 51 26 PM

Build Libraries for distribution - Turn. it to no.

for both targets. this allowed me to run application normal no issues wer occured

jigarfumakiya commented 2 years ago

@niyasmhdth Did you make release build? Check for errors

mineshamin1 commented 2 years ago

I am having same issue. what is the fix?

withniyaz commented 2 years ago

@niyasmhdth Did you make release build? Check for errors

Haven't yet but soon. hope it wont have release errors

rkumar1904 commented 2 years ago
Screenshot 2021-11-22 at 4 50 05 PM

Build Libraries for distribution - Turn. it to no.

Screenshot 2021-11-22 at 4 51 26 PM

Build Libraries for distribution - Turn. it to no. for both targets. this allowed me to run application normal no issues wer occured

I tried it, it's not working 🤔

withniyaz commented 2 years ago
Screenshot 2021-11-22 at 4 50 05 PM

Build Libraries for distribution - Turn. it to no.

Screenshot 2021-11-22 at 4 51 26 PM

Build Libraries for distribution - Turn. it to no.

for both targets. this allowed me to run application normal no issues wer occured

I tried it, it's not working 🤔

Which Xcode version are u using?

mineshamin1 commented 2 years ago

I added the following file in the Podfile and now able to build successfully. This is required specifically for the new M1 chip.

config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"

Podfile code,

_post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
        config.build_settings['ENABLE_BITCODE'] = 'YES'
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end
end_
ArkRavi commented 2 years ago
Screenshot 2021-12-03 at 3 40 24 PM

Pods in Xcode => Pods => Build Settings => Build architecture only
Set every flavor to YES This makes app running in simulator But i'm not sure that weather it's a good thing to do for release version

ramprasadAnand commented 2 years ago

Please remove the razorpay-flutter dependency from pubspec.yaml file and save it. and reinstall the razorpay-flutter dependency to fix this issue. Make sure the installed razorpay-pod version is 1.1.17.

the-kool-sk commented 2 years ago

Created new flutter project Add razorpay dependency in pubspec.yaml Cleaned and rebuild the flutter app Run the project again on iOS simulator and build failed

Screenshot 2021-12-24 at 12 34 34 PM Screenshot 2021-12-24 at 12 35 26 PM

Can anyone help here? Please 🙏🏻 Thanks in advance.

jigarfumakiya commented 2 years ago

Hey @the-kool-sk No response from the RazorPay team. For now, you can move back to flutter version 2.2 and it will work.

hardikvij195 commented 2 years ago

@jigarfumakiya @rkumar1904 @niyasmhdth @razorpay-sanjib did u guys find any sol ?... I upgraded my flutter to latest 2.8.1 and app is running on android but on iOS I am still stuck on the same issue.

jigarfumakiya commented 2 years ago

@hardikvij195 check this.

Hey @the-kool-sk No response from the RazorPay team. For now, you can move back to flutter version 2.2 and it will work.

the-kool-sk commented 2 years ago

Hey @the-kool-sk No response from the RazorPay team. For now, you can move back to flutter version 2.2 and it will work.

Issue with this way is, we need to downgrade most of the other packages which we are using in application. So not an ideal solution.

jigarfumakiya commented 2 years ago

Hey @the-kool-sk No response from the RazorPay team. For now, you can move back to flutter version 2.2 and it will work.

Issue with this way is, we need to downgrade most of the other packages which we are using in application. So not an ideal solution.

I know it is not an ideal solution but this Is the only solution as of now.

ramprasadAnand commented 2 years ago

We have added swift module stability from version 1.1.17, which will solve the above swift version incompatibility issue. Please make sure to you have the razorpay-pod version as 1.1.17 inside ios -> podfile.lock.

the-kool-sk commented 2 years ago

Tried not working, Tried on Xcode 12.2 and 13.1 and 13.2.1

ramprasadAnand commented 2 years ago

If you are running on simulator, please add the below lines in the Podfile and do the pod install and run.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end
expertmars commented 2 years ago

I have fixed my issue by downgrading the flutter. I have recently upgraded flutter to 2.10 and faced these issue.

flutter downgrade v2.3.3

rahul69x commented 2 years ago

If you are running on simulator, please add the below lines in the Podfile and do the pod install and run.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Thanks, it works

JCZ2014 commented 2 years ago

M1芯片上Xcode 14 beta 2编译还是错误