Apple Pay action sheet crashes when returning empty array for PKShippingMethod in didSelectShippingContact callback
| Originator: | keithnorm | ||
| Number: | rdar://25242253 | Date Originated: | 3/18/2016 |
| Status: | closed | Resolved: | 9.3 |
| Product: | iOS | Product Version: | |
| Classification: | Reproducible: | always |
Summary:
The app I work on requires a shipping address when checking out with Apple Pay but does not require shipping methods because it is a delivery service so there is no shipping. However, when implementing the `didSelectShippingContact` delegate of `PKPaymentAuthorizationViewControllerDelegate` if it returns `[]` for shipping methods, then PassbookUI crashes with the attached log.
Sample project as well is here https://github.com/keithnorm/apple-pay-crash
Steps to Reproduce:
1. either download and configure my sample project to work with your apple pay merchant, or create a basic apple pay button that opens a `PKPaymentAuthorizationViewController` whose delegate implements this:
```
func paymentAuthorizationViewController(controller: PKPaymentAuthorizationViewController, didSelectShippingContact contact: PKContact, completion: (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) -> Void) {
completion(.Success, [], [PKPaymentSummaryItem(label: "summary 1", amount: 10.0)])
}
```
2. run the app, hit "Buy with Apple Pay"
3. select shipping address, hit back
4. Apple Pay modal crashes
Expected Results:
Ideally returning an empty array for shipping methods would not crash and would not render an empty row in the apple pay modal.
Actual Results:
crashes on 9.2, renders empty row on other versions
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!