Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Swift App Crashed after Adding stripe-ios-spm to Package Dependencies #4241

Open
HaominZhao opened this issue Nov 10, 2024 · 1 comment
Labels
kind:bug triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@HaominZhao
Copy link

HaominZhao commented Nov 10, 2024

Summary

My swift app with following page was rendered successfully. After trying to add stripe-ios-spm to Package Dependencies, my app crash in simulator/real device. But preview worked. I didn't even add any code related to stripe but installed the package. If I delete the stripe-ios-spm dependency, it worked again. I am wondering if there is any conflict between stripe ios sdk and the following code? Is stripe compatible with NavigationStack and nested navigation?

Code to reproduce

import SwiftUI

struct ListingExploreView: View {
    var city: City
    @ObservedObject var viewModel: ListingExploreViewModel
    @State private var showListingSearchView = false
    
    var body: some View {
        if showListingSearchView {
            ListingSearchView(showView: $showListingSearchView,
                    viewModel: viewModel)
            .navigationBarHidden(true)
        }
        else {
            SearchBarView(city: city, viewModel: viewModel)
               .onTapGesture {
                   withAnimation(.snappy) {
                       showListingSearchView.toggle()
                   }
               }
            
            ScrollView(.vertical) {
                // listings
                LazyVStack(spacing: 32) {
                    ForEach(viewModel.listings) { listing in
                        NavigationLink(value: listing) {
                            ListingItemView(listing: listing)
                        }
                    }
                }
            }
            .navigationDestination(for: Listing.self) { listing in
                ListingDetailsView(listing: listing, search: viewModel.search)
                    .navigationBarBackButtonHidden()
            }
        }
    }
}

#Preview {
    ListingExploreView(city: Mock.cities[2], viewModel: ListingExploreViewModel(with: MockListingExploreServiceImpl()))
}

iOS version

Simulator: Iphone 16 pro

Installation method

1. In Xcode, select File > Add Packages… and enter https://github.com/stripe/stripe-ios-spm as the repository URL.
2. Select the latest version number from our [releases page](https://github.com/stripe/stripe-ios/releases).
3. Add the StripePaymentSheet product to the [target of your app](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app).

SDK version

24.0.0

Other information

@davidme-stripe
Copy link
Contributor

Hi @HaominZhao, thanks for filing this! If you're not even importing Stripe, the imported package should have no impact on the NavigationStack of your app. Can you share the crash log you received?

@davidme-stripe davidme-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

2 participants