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] TWINT Apps cannot be opened when adding payment method (Fatal error/Crash) #1902

Closed
ast3150 opened this issue Nov 19, 2024 · 17 comments
Closed

Comments

@ast3150
Copy link

ast3150 commented Nov 19, 2024

Describe the bug
When trying to register TWINT as a payment method, the application crashes with a fatal error:

Fatal error: NSArray element failed to match the Swift Array Element type
Expected TWAppConfiguration but found TWAppConfiguration

To Reproduce
Steps to reproduce the behavior:

  1. Build app with Ayen TWINT Native integration
  2. Click on 'Add payment method'
  3. Choose TWINT as payment method
  4. Application crashes with fatal error

Expected behavior
The application does not crash and the selection which TWINT app should be opened is presented.

Screenshots
n/a

Environment

  • Device: iPhone 16 Pro
  • iOS Version: iOS 18.1
  • SDK Version: 5.13.0
  • Adyen API Version: unknown
  • Package management system: SPM
  • Xcode version: 16.1 (16B40)
  • Mac OS type: M1 Max

Relevant source code
File/Line: TwintSDKActionComponent.swift:105
Method: public func handle(_ action: TwintSDKAction)
Line: guard let firstApp = installedApps.first else {

Additional context

  • Twint apps are configured with LSApplicationQueriesSchemes and integration is made as documented in AdyenTwint.md
@ast3150 ast3150 added the bug label Nov 19, 2024
@atmamont
Copy link
Contributor

Thanks for reporting @ast3150!

Could you provide additionally the following:

  • full crash stack trace
  • how you import Twint SDK framework (a screenshot of Xcode General -> Frameworks, Libraries and Embedded content settings might give us something)

TWINT test environment doesn't support iOS18 at the moment so we have limited means for investigation, just to set expectations it might take some time to sort it out.

@ast3150
Copy link
Author

ast3150 commented Nov 20, 2024

Sure, here you go.
FELFEL-2024-11-20-182701.ips.zip

We import the Adyen and AdyenTwint library through Swift Package Manager. Both are added to the "Frameworks, Libraries and Embedded Content" section as normal libraries.
Screenshot 2024-11-20 at 18 33 19

Please note that after reinstalling the library and app, I am currently no longer able to reproduce a crash. However, there is also no progress after choosing the payment method:

Screenshot 2024-11-20 at 18 49 21

@atmamont
Copy link
Contributor

Thanks for logs provided, it helps to narrow down the root cause.

As long as we cannot reproduce the crash, we can only have assumptions:

  • is this the first time you integrate Twint or this crash occured after upgrading Adyen SDK to 5.13.0?
  • Any chance you have TwintSDK imported along with AdyenTwint? It is not necessary as AdyenTwint uses TwintSDK.
  • Regarding the last screenshot with the No such process found error. Is this a chunk of logs that are filtered? Did you try to look for non-error messages?
  • TWINT SDK version that we use now doesn't support iOS18 properly and the testing infra is not ready yet from TWINT side. We cannot release new SDK version fully compatible with iOS18 until we test everything on our side. We are in full contact with TWINT team to speed up the process. This is a known issue and was reported before.

@nauaros
Copy link
Contributor

nauaros commented Nov 22, 2024

Hi @ast3150!

Taking over @atmamont here.

We’ve created a new branch (#1905) where the TwintSDK has been updated to version 8.0.2.

This update resolves the compatibility issue with iOS 18 caused by the deprecated openURL(_:) method.

However, due to limitations in Twint’s ability to provide a complete TEST environment, we have not been able to fully test the entire Twint payment flow. That said, we have successfully verified that the app-to-app switch functionality works with this update.

We encourage you to try out this branch in the meantime while we continue working on verifying the full flow. Once the changes are thoroughly tested, we’ll include them in an official release.

We apologize for any inconvenience caused by these third-party dependencies. If you encounter any issues, please let us know. Thank you for your understanding and cooperation!

Disclaimer: Be aware this is not part of an official release, so keep in mind there can potentially be issues with the update that's why we encourage you to run test to make sure the whole Twint payment flow works as expected on iOS 18.

@ast3150
Copy link
Author

ast3150 commented Nov 25, 2024

Hi there. To answer the stuff above:

is this the first time you integrate Twint or this crash occured after upgrading Adyen SDK to 5.13.0?

no, we have integrated Adyen before, but we're switching from the web-based flow to Adyen-twint-native now.

Any chance you have TwintSDK imported along with AdyenTwint? It is not necessary as AdyenTwint uses TwintSDK.

no, we don't use Twint SDK directly, only through Adyen

Regarding the last screenshot with the No such process found error. Is this a chunk of logs that are filtered? Did you try to look for non-error messages?

I didn't see any relevant non-error messages.

We'll try out the provided feature branch, thanks!

@nauaros
Copy link
Contributor

nauaros commented Nov 26, 2024

Hi @ast3150

Just wanted to let you know that we have been able to test the new update. Everything works fine and it will be included in our next release (v5.14.0) in the coming week. Thank you!

P.S. We will keep this issue opened for now in case you wanna provide any feedback. By the time we release, we will close it.

@goergisn
Copy link
Contributor

goergisn commented Dec 3, 2024

Hi @ast3150

We just shipped 5.14.0 which uses the latest version provided by Twint. This should resolve your issue.

I'm closing the issue but feel free to re-open if there are any additional questions. :)

@elitalon
Copy link

elitalon commented Dec 4, 2024

@goergisn I just tried 5.14.0 and I'm experiencing the same crash. Here are the details of our integration:

Environment

  • Device: iPhone SE 2nd Generation
  • iOS Version: 18.2
  • SDK Version: 5.14.0
  • Adyen API Version: 71
  • Package management system: SPM
  • Xcode version: 16.1 (16B40)
  • Mac OS type: M3

Relevant source code
TwintSDKActionComponent.handle(_:), at line 115.

Additional context

  • I only have one TWINT app installed: PostFinance TWINT
  • maxIssuerNumber is set to the default value (.max)
  • URL schemes in LSApplicationQueriesSchemes are set from twint-issuer1 to twint-issuer44 only (we don't have more space 😓)
  • At the moment when the exception is thrown in TwintSDKActionComponent.handle(_:), the installedApps parameter of the closure only contains one value (see screenshot below)

nsarray_type_mismatch

We also get this message in the console at launch time when dylib3 is resolving symbols, which makes sense because our app also integrates the Datatrans SDK:

objc[7220]: Class TWAppConfiguration is implemented in both /private/var/containers/Bundle/Application/0ABCBE97-42AD-4403-B69C-0C154C92ED66/<redacted>/Frameworks/Datatrans.framework/Datatrans (0x10463e3f0) and /private/var/containers/Bundle/Application/0ABCBE97-42AD-4403-B69C-0C154C92ED66/<redacted>/Frameworks/TwintSDK.framework/TwintSDK (0x1026de250). One of the two will be used. Which one is undefined.

Do you have a hint as to how we can overcome that?

@goergisn goergisn reopened this Dec 4, 2024
@goergisn
Copy link
Contributor

goergisn commented Dec 4, 2024

Hi @elitalon
We just tried to reproduce the crash but we didn't manage to (iOS 18.2, iPhone 14 Pro, one Twint app installed)

  • Do you know which version of the Twint SDK the Datatrans SDK is using? There might be a mismatch.
  • Is there a way you can try it without having Datatrans SDK?

@elitalon
Copy link

elitalon commented Dec 5, 2024

@goergisn Let's see if I can make a test without Datatrans SDK and gather that information for you. I'll let you know once I have more details.

@elitalon
Copy link

elitalon commented Dec 6, 2024

@goergisn After removing the Datatrans SDK, I don't have the crash anymore.

Now the registration fails on the TWINT app side with an "Invalid code" error. But I think that's because I'm using the Test environment with the production app. So let's leave that aside for now.

Unfortunately, I couldn't find a trace of the Twint SDK Datatrans is using. I have reported the issue on their side.

In the meantime, do you see a way for us to move forward?

@goergisn
Copy link
Contributor

goergisn commented Dec 6, 2024

Hi @elitalon
I managed to reproduce it by including the Datatrans SDK

Currently looking into what we can do about it, but it seems that Datatrans and Adyen ship the TwintSDK and thus there is a naming collision caused with TWAppConfiguration.

I'll keep you posted.

@goergisn
Copy link
Contributor

goergisn commented Dec 6, 2024

Hi @elitalon
I updated the branch from #1913 to use the Statically linked TwintSDK which seems to resolves the issue.

Could you give it a try? (Make sure to reset your package caches)

@elitalon
Copy link

elitalon commented Dec 9, 2024

@goergisn Unfortunately I'm still facing the same crash 😕

Datatrans provided a couple of alternatives besides using a static framework, but I'm not sure how viable they're on your side.

@goergisn
Copy link
Contributor

goergisn commented Dec 9, 2024

Hi @elitalon, just to double check:

1. Can you use Update Package

(We noticed that reset package caches does not work reliably when the target is a branch and not a version)

Screenshot 2024-12-09 at 15 45 16

2. ... and make sure that the path actually changes inside of the Package.swift file of the Adyen SDK dependency?

Screenshot 2024-12-09 at 15 44 20

On our side this fixes the reproducible issue when using Datatrans + Adyen via SPM.

@elitalon
Copy link

Hi @goergisn,

I can confirm that on our side we have the same setup, both for the custom branch in SPM:

custom_branch

As well as the entry in the package manifesto:

static_package

Note that we are also including AdyenTwint in the list of linked frameworks:

linking_frameworks

If I remove that, the crash is gone. But then we are back to square one with the web-based interface of the drop-in:

@nauaros
Copy link
Contributor

nauaros commented Jan 8, 2025

Hi there!

Closing this issue as the fix has been released on v5.15.0. Feel free to reopen if the problem remains.

Thanks!

@nauaros nauaros closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants