razorpay / razorpay-pod

:iphone: CocoaPod implementation of Razorpay's Payment SDK. Refer for instructions:
https://docs.razorpay.com/v1/page/ios-integration
MIT License
21 stars 18 forks source link

Can't add Razorpay pod to M1 chip Macbook #138

Closed somesh-basicx closed 2 years ago

somesh-basicx commented 2 years ago

Description

Getting error on MacBook M1 chip that says module compiled with Swift 5.5.1 cannot be imported by the Swift 5.5.2 compiler: /Users/someshk/Documents/iOSProjects/BASICX SPORT/Pods/razorpay-pod/Pod/Razorpay.framework/Modules/Razorpay.swiftmodule/arm64.swiftmodule and unable to load standard library for target 'arm64-apple-ios10.0' after adding razorpay-pod to new iOS project

Razorpay pod Version :

pod 'razorpay-pod', '~> 1.1.17'

Xcode Version :

Version 13.2.1 (13C100)

What you did:

Nothing just added Razorpay to the project. After adding the project started showing error!

What happened:

<unknown>:0: error: unable to load standard library for target 'arm64-apple-ios10.0'
<unknown>:0: error: unable to load standard library for target 'arm64-apple-ios10.0'
<unknown>:0: error: unable to load standard library for target 'arm64-apple-ios10.0'
/Users/someshk/Documents/iOSProjects/BASICX SPORT/BASICX SPORT/controllers/shop/PaymentViewController.swift:9:8: error: module compiled with Swift 5.5.1 cannot be imported by the Swift 5.5.2 compiler: /Users/someshk/Documents/iOSProjects/BASICX SPORT/Pods/razorpay-pod/Pod/Razorpay.framework/Modules/Razorpay.swiftmodule/arm64.swiftmodule
import Razorpay

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Just Add Razorpay pod to ios project on M1 chip
ramprasadAnand commented 2 years ago

Hi @somesh-basicx, Created a sample iOS project on M1 chip machine, and followed the same steps as mentioned. We are able to build and run the app on iOS Simulator.

Xcode Version - 13.2.1 pod 'razorpay-pod', '1.1.17'

somesh-basicx commented 2 years ago

@architect Did you exclude any architectures in build settings? or was it a completely fresh project with default settings?

ramprasadAnand commented 2 years ago

@somesh-basicx No, I haven't done any changes to architecture build settings, it is a new project with default settings.

somesh-basicx commented 2 years ago

@ramprasadAnand When I created a sample app it also worked but when I added other common libraries like Kingfisher & Lottie it started giving me the same error as above! and to overcome that issue I had to add this in Podfile

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
            config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        end
    end
end

and it started working. Just putting it out here in case someone else stumbles upon this in the future.