2

I already build and run my flutter app for Andriod. But when I trying to build it for Mac first time its showing the following error.

I'm new to mac env. Do I have to make some changes in Xcode? My Xcode version :Version 13.2.1. But If I make a new flutter project in my MAC using VS CODE its runing well and good. I have to run my exting flutter app for ios. Help me to achive this for iOS.

    Launching lib/main.dart on iPhone 13 in debug mode...
lib/main.dart:1
Xcode build done.                                            9.0s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    Command CompileSwiftSources failed with a nonzero exit code
    <unknown>:0: error: unable to load standard library for target 'arm64-apple-ios10.0'
/Users/sambitdas/Development/flutter/.pub-cache/hosted/pub.dartlang.org/razorpay_flutter-1.2.7/ios/Classes/RazorpayDelegate.swift:2:8: error: module compiled with Swift 5.5.1 cannot be imported by the Swift 5.5.2 compiler: /Users/sambitdas/sleepKart/sleepkart/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/sambitdas/Development/flutter/.pub-cache/hosted/pub.dartlang.org/razorpay_flutter-1.2.7/ios/Classes/RazorpayDelegate.swift:2:8: error: module compiled with Swift 5.5.1 cannot be imported by the Swift 5.5.2 compiler: /Users/sambitdas/sleepKart/sleepkart/ios/Pods/razorpay-pod/Pod/Razorpay.framework/Modules/Razorpay.swiftmodule/arm64.swiftmodule
    import Razorpay
           ^
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)
Ravi Limbani
  • 1,092
  • 5
  • 16
Toujo
  • 295
  • 3
  • 17
  • make sure you have an iOS 10 simulator up and running. delete derived data, clean build folder. and run again. – Abdul Momen Dec 26 '21 at 09:09
  • X-code only allow me from iOS version-11 upto iOS version-15.2..But if I remove Razorpay dependency from pubspec..ymal then its works perfectly.. Is this a razorpay related problem? (I'm running my exiting flutter code in VS-code in my mac) – Toujo Dec 27 '21 at 09:45
  • Did you solve this @Toujo – G H Prakash Feb 25 '22 at 07:35
  • Yes. I've to do 2 thing. `First:` I connect xcode with real iPhone device(no need extra login or registration. Just pluged in and it will automatically verify). `Second`: Follow `Ravi Limbani` code below. Official Razorpay aslo send me this solution for changing in pod file – Toujo Mar 11 '22 at 09:00

2 Answers2

4

In podfile replace post_install with below code is worked for me

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
Ravi Limbani
  • 1,092
  • 5
  • 16
0

use terminal and try this:

cd ios

arch -x86_64 pod install