关于此question,感谢您缩小范围。但是可惜我必须配置这个委托

- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller
               didSelectShippingMethod:(PKShippingMethod *)shippingMethod
completion:(void (^)(PKPaymentAuthorizationStatus, NSArray *summaryItems))completion
{
    completion(PKPaymentAuthorizationStatusSuccess, [self summaryItemsForShippingMethod:shippingMethod]);
}

- (NSArray *)summaryItemsForShippingMethod:(PKShippingMethod *)shippingMethod
{
    totalPrice = 5;
    NSString *prices = [NSString stringWithFormat:@"%d",totalPrice];
    NSDecimalNumber *num = [[NSDecimalNumber alloc] initWithString:prices];
    PKPaymentSummaryItem *foodItem = [PKPaymentSummaryItem summaryItemWithLabel:@"Total Products Cost" amount:num];
    NSDecimalNumber *total = [foodItem.amount decimalNumberByAdding:shippingMethod.amount];
    PKPaymentSummaryItem *totalItem = [PKPaymentSummaryItem summaryItemWithLabel:@"Video Mantis Productions, INC." amount:total];
    return @[foodItem, shippingMethod, totalItem];
}


为了向用户展示什么是产品摘要。可悲的是,我将PKPaymentSummaryItem * foodItem设置为nil,因此该处理程序从未得到修复。请帮忙!先感谢您。

最佳答案

那么答案,是吗?我使用Stripe作为与ApplePay进行交易的中间媒介,因此也使用其SDK和教程来设置ApplePay。无论如何,Passkit的PKPaymentAuthorizationViewController使用可以配置的两个独立协议,以帮助简化实现。我同时使用了两者;

- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller
                   didSelectShippingMethod:(PKShippingMethod *)shippingMethod
                                completion:(void (^)(PKPaymentAuthorizationStatus status, NSArray *summaryItems))completion;


和...

- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller
                  didSelectShippingAddress:(ABRecordRef)address
                                completion:(void (^)(PKPaymentAuthorizationStatus status, NSArray *shippingMethods, NSArray *summaryItems))completion;


但是,我注意到的是调用后一个时机,即didSelectShippingAddress,Passkit类停滞了,所以我将其删除,仅使用了第一个即didSelectShippingMethod来帮助实现整个过程,并且无限处理从未发生过。再次!希望它也对您有用(:

10-08 12:25