AppSales-Mobile
AppSales-Mobile copied to clipboard
Payments Download Crash
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];
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.
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.
Perhaps we had differing data being returned. I've added that line now too.