AppSales-Mobile icon indicating copy to clipboard operation
AppSales-Mobile copied to clipboard

Payments Download Crash

Open pupasani opened this issue 1 year ago • 3 comments

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];

pupasani avatar Nov 04 '23 20:11 pupasani

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 https://github.com/nicolasgomollon/AppSales-Mobile/pull/65

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

ddaddy avatar Nov 05 '23 11:11 ddaddy

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.

pupasani avatar Nov 05 '23 19:11 pupasani

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

ddaddy avatar Nov 06 '23 09:11 ddaddy