-
Notifications
You must be signed in to change notification settings - Fork 26
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
Use of deprecated UIAlertView causes crash with UIScene based applications (i.e. iOS 13) #93
Comments
I've found the reason why an alert was being triggered when I initiated a payment again. I was using the same foreign transaction ID again. This is presumably is not allowed even if the first payment was cancelled. However, this does not solve the underlying issue that the SumUp SDK is using UIAlertView which has been deprecated for many years. If it wasn't deprecated, I would presumably have received a helpful error message. Instead, I got a bug that completely crashed the app with no feedback on what was causing the alert to be displayed. It would be good to see this kind of thing fixed if people are going to have confidence in building an app on top of the SDK. On a similar note, I get the following warning when I build, due to the SumUp SDK. I've seen others have reported this also. It doesn't seem to be causing any issues but it's irritating to have to ignore this warning every single time.
A little more regular maintenance on the SDK would be a big help – it's generally good but as I say lack of updates/fixes undermines confidence in relying on it. |
Hi @pierceglennie! Sorry for the late reply, we have just recently released version 4.0.1, where all I hope this helps! I am closing this issue, but feel free to reach out if you face any more problems. |
Hi @pierceglennie, I am right that the VC is only to present the Login? |
Hi @solutionpark, The view controller is used for everything – login screen and things like the payment screen. It's been quite a while since I looked at this and I was quite new to Swift at the time, so my code will be messy. However, I've put various snippets below that may help you. First, here's a SumUpData observable object I define which contains all settings related to the SumUp view controller:
Next, I have my UIViewControllerRepresentable which takes this SumUpData observable object.
Finally, to use SumUp inside a SwiftUI view I add a SumUpData StateObject inside my view:
Further down, inside the body of the view I do a ZStack with my main view content and the SumUp UIViewControllerRepresentable. Specially, I add this view like the following – note the onChange that's not necessary to get something basic working but is used to respond to a payment going through.
Finally, to actually make it all work my "Pay Now" button within the SwiftUI view just does the following:
This triggers the SumUp UIViewControllerRepresentable to show the relevant screen – login if necessary, otherwise payment screen – and take the payment. Sorry this is so long and messy but I thought it was more helpful to provide lots of example code rather than accidentally missing the crucial part. Let me know if you have any questions (or ideas about cleaning it up – I'm sure there are improvements that could be made if it was refactored, I kind of stopped once it was working). |
@@pierceglennie, you saved my day! (month). Thanks again and I wish you a productive 2021! |
I'm using the SumUp SDK with a SwiftUI app targeting iOS 13. Mostly it works fine. I use UIViewControllerRepresentable in SwiftUI to incorporate the SumUp UIViewController within SwiftUI.
However, I'm coming across the following error in some situations (steps to reproduce below):
Presumably, this means that the SumUp SDK is still using UIAlertView to show some alerts, even though it was deprecated in iOS 8. The steps I've used reproduce this bug are as follows, although there may be other situations where the SumUp SDK is trying to use UIAlertView:
The solution seems to be for SumUp to remove all uses of UIAlertView since it is deprecated and completely unavailable for some iOS 13 apps. It should be replaced by UIAlertViewController.
Note that I've tried using version 3.5b1 of the SDK and this does not resolve the issue. Without a fix, it will be impossible to use SumUp within my SwiftUI app and I'll have to find an alternative provider.
The text was updated successfully, but these errors were encountered: