jonasbark / flutter_stripe_payment

[DISCONTINUED] A flutter plugin with stripe payment plugin integration
MIT License
307 stars 243 forks source link

Apple M1 - Not Running on Simulator - Got Error 'symbols not found for architecture arm64' #342

Closed ghulamsabir5353 closed 2 years ago

ghulamsabir5353 commented 2 years ago

Xcode's output: ↳ ld: warning: ignoring file /Users/ghulamsabir/"ProjectPath"/build/ios/Debug-iphonesimulator/Stripe/ Stripe.framework/Stripe, missing required architecture arm64 in file /Users/ghulamsabir/"ProjectPath"/build/ios/Debug-iphonesimulator/Stripe/ Stripe.framework/Stripe (2 slices) Undefined symbols for architecture arm64: "_OBJCCLASS$_STPAPIClient", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPSetupIntentConfirmParams", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPAppInfo", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPPaymentIntentParams", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPPaymentMethodParams", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPTheme", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPPaymentMethodBillingDetails", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPPaymentMethodAddress", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPCardParams", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPAddCardViewController", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPAddress", referenced from: objc-class-ref in TPSStripeManager.o "_STPStringFromCardBrand", referenced from: -[StripeModule cardBrandAsPresentableBrandString:] in TPSStripeManager.o "_OBJCCLASS$_STPPaymentHandler", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPBankAccountParams", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPPaymentConfiguration", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_Stripe", referenced from: objc-class-ref in TPSStripeManager.o (maybe you meant: _OBJCCLASS$_StripePaymentPlugin, _OBJCCLASS$_StripeModule ) "_OBJCCLASS$_STPPaymentMethodCardParams", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPUserInformation", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPRedirectContext", referenced from: objc-class-ref in TPSStripeManager.o "_OBJCCLASS$_STPSourceParams", referenced from: objc-class-ref in TPSStripeManager.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at /System/Volumes/Data/SWE/macOS/BuildRoots/b8ff8433dc/Library/Caches/com.apple.xbs/Sources/rsyn c/rsync-55/rsync/rsync.c(244) [sender=2.6.9] Command PhaseScriptExecution failed with a nonzero exit code note: Using new build system note: Planning note: Build preparation complete note: Building targets in parallel

Could not build the application for the simulator. Error launching application on iPhone 13.

ghulamsabir5353 commented 2 years ago

Anyone can help me this issue?

lifeapps-42 commented 2 years ago

try adding this in your Podfile

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['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" # this
      config.build_settings["ONLY_ACTIVE_ARCH"] = "YES" # and this
    end
  end
end

Don't forget to flutter clean and reinstall pods Worked for me

ghulamsabir5353 commented 2 years ago

Hey @lifeapps-42 After deleting Podfile.lock and I'm trying to reinstall the pod install but getting error:

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods... Searching for inspections failed: undefined method `map' for nil:NilClass

lifeapps-42 commented 2 years ago

can you provide your Podfile here?

ghulamsabir5353 commented 2 years ago

Uncomment this line to define a global platform for your project

platform :ios, '10.0'

CocoaPods analytics sends network stats synchronously affecting flutter build latency.

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', { 'Debug' => :debug, 'Profile' => :release, 'Release' => :release, }

def flutter_root generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), FILE) unless File.exist?(generated_xcode_build_settings_path) raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end

File.foreach(generated_xcode_build_settings_path) do |line| matches = line.match(/FLUTTER_ROOT\=(.*)/) return matches[1].strip if matches end raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do use_frameworks! use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(FILE)) end

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["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" # this end end end

ghulamsabir5353 commented 2 years ago

in /ios i run "arch -x86_64 pod install"

ghulamsabir5353 commented 2 years ago

After running "arch -x86_64 pod install" I already struck on "Running pod install... "

lifeapps-42 commented 2 years ago

Please check my podfile code, you need to add one more line.

I'm not really sure if it is the only reason, but try.

ghulamsabir5353 commented 2 years ago

This PODFILE setting work 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['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" # this config.build_settings["ONLY_ACTIVE_ARCH"] = "YES" # and this end end end