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

Payments Download Crash #66

Open
pupasani opened this issue Nov 4, 2023 · 3 comments
Open

Payments Download Crash #66

pupasani opened this issue Nov 4, 2023 · 3 comments

Comments

@pupasani
Copy link

pupasani commented Nov 4, 2023

The app consistently crashes while downloading payments for me every month. I found the fix, it is simple. Nicholas can you please apply this to the code? Shown in BOLD below.

In ReportDownloadOperation, fetchPaymentsForVendorID, line 431, please insert this check for nil paymentData. Else it crashes the NSJSONSerialization call.

NSData *paymentData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:paymentURL]
returningResponse:nil error:nil];
if (paymentData == nil)
return;

NSDictionary *payment = [NSJSONSerialization JSONObjectWithData:paymentData options:0 error:nil];

ddaddy added a commit to ddaddy/AppSales-Mobile that referenced this issue Nov 5, 2023
@ddaddy ddaddy mentioned this issue Nov 5, 2023
@ddaddy
Copy link

ddaddy commented Nov 5, 2023

Hey 👋
I've fixed this for you today. Your solution was almost correct, however the paymentData wasn't nil, it had a payload but without the payment data.
Adding if (payment == nil || [payment isEqual:NSNull.null]) { continue; } seems to have fixed it.

You can download the fix and several other fixes and improvements from my Pull Request #65

I'm not sure if @nicolasgomollon views this repo any more, but hopefully he'll merge the PR soon.

@pupasani
Copy link
Author

pupasani commented Nov 5, 2023

Thanks but I had run this in the debugger at the time and paymentData was definitely nil for the crash. So I would suggest keeping that check as well your new check for payment.

ddaddy added a commit to ddaddy/AppSales-Mobile that referenced this issue Nov 6, 2023
@ddaddy
Copy link

ddaddy commented Nov 6, 2023

Perhaps we had differing data being returned. I've added that line now too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants