stripe-ios
stripe-ios copied to clipboard
[BUG] Failed to find an image named icon_x_standalone
Summary
I'm having a crash on an image not found
StripeUICore/ImageMaker.swift:51: Assertion failed: Failed to find an image named icon_x_standalone
The weird thing is that the crash happens on the PaymentSheet.present, but it does not crash on the CustomerSheet.present somewhere else in the app... And other thing which is weird, it seems that the crash only happens when i use the app when it's still linked to xcode
Code to reproduce
public func presentPaymentSheet(customerId: String, ephemeralKey: EphemeralKey, paymentIntentClientSecret: String, completion: @escaping (StripePaymentSheetResultEnum) -> Void) {
var applePayConfiguration: PaymentSheet.ApplePayConfiguration? = nil
if let merchantId = Bundle.main.object(forInfoDictionaryKey: "MerchantId") as? String {
applePayConfiguration = PaymentSheet.ApplePayConfiguration(merchantId: merchantId, merchantCountryCode: "FR")
}
var configuration = PaymentSheet.Configuration()
configuration.merchantDisplayName = "Rythmetech."
configuration.customer = .init(id: customerId, ephemeralKeySecret: ephemeralKey.secret)
configuration.appearance.font.base = RawFonts.latoLight.font(size: 14)
configuration.appearance.colors.primary = Asset.DesignSystem.primaryColor
configuration.appearance.colors.danger = Asset.Colors.redE4.color
configuration.applePay = applePayConfiguration
let paymentSheet = PaymentSheet(paymentIntentClientSecret: paymentIntentClientSecret, configuration: configuration)
paymentSheet.present(from: sourceViewController!) { result in
switch result {
case .canceled:
completion(.canceled)
case .completed:
completion(.completed)
case .failed(let error):
completion(.failed(error: error))
}
}`
iOS version
Installation method
I'm using cocoapods
def stripe_pods pod 'Stripe', '~> 23.20.0' pod 'StripePaymentSheet', '~> 23.20.0' end
def shared_pods pod 'PhoneNumberKit', '~> 3.7.0' pod 'SwiftGen', '~> 6.6.0' pod 'ScanditBarcodeCapture', '~> 6.20.0' pod 'RealmSwift', '~> 10.32.0' pod 'Intercom', '~> 14.1.0' pod 'MessageKit'
common_pods stripe_pods pod 'SGSegmentedProgressBarLibrary' end
target "RythmePayment" do project './RythmePayment/RythmePayment.xcodeproj' common_pods stripe_pods end
target 'Rythme' do shared_pods firebase_pods
target 'RythmeTests' do inherit! :search_paths # Pods for testing end
target 'RythmeUITests' do # Pods for testing end end
`
But i'm using frameworks, so Rythme is using RythmePayment framework to present the PaymentSheet
SDK version
23.20.0'
Other information
I'm wondering if my podfile is wrong, and i got 2 instances of the stripe pod and there is a conflict
Hi @clementmorissard, can you try removing pod 'Stripe', '> 23.20.0'
and running pod install
again?
Hello @yuki-stripe, I justed tested to remove pod 'Stripe', '> 23.20.0'
and changing my imports from import Stripe
with import StripePaymentsSheet
but i'm having the same crash
I did some tests:
var image = UIImage(
named: imageName, in: BundleLocator.resourcesBundle, compatibleWith: traitCollection)
if image == nil {
image = UIImage(named: imageName, in: nil, compatibleWith: traitCollection)
}
if templateIfAvailable {
image = image?.withRenderingMode(.alwaysTemplate)
}
print("ImageMakerBundleLocator = \(BundleLocator.resourcesBundle), imageName = \(imageName)")
return image
}
I dont know if its normal to have the "not yet loaded" on the bundle
</var/containers/Bundle/Application/751A6ABF-2BDB-4909-BB3B-432FF9CA13C7/Rythme.app/Frameworks/StripePaymentSheet.framework/StripePaymentSheet.bundle> (not yet loaded), imageName = icon_x_standalone ImageMakerBundleLocator = NSBundle </var/containers/Bundle/Application/751A6ABF-2BDB-4909-BB3B-432FF9CA13C7/Rythme.app/Frameworks/StripeUICore.framework/StripeUICore.bundle> (not yet loaded), imageName = icon_chevron_down
I am using latest version of stripe in iOS also facing same issue in device but in simulator it working fine so @yuki-stripe can you please solve this issue and update new version