Pages

Wednesday, March 27, 2013

SKPaymentTransactionStateFailed, but no error property returned?

Hi. We have an app with IAP coin purchases. We've recently received mail from one of our users, saying he couldn't purchase any coins. I looked at his session logs and saw 3 Failed IAP events, but no fail reason logged. Here's the related code:

 

- (void)_purchaseRequestFailed:(SKPaymentTransaction *)transaction state:(StoreTransactionState)state error:(NSError *)error

{

    IAPProduct *product = [self getProductWithId:transaction.payment.productIdentifier];

    if (error.code==SKErrorPaymentCancelled) {

        [_metricsManager logFailIAP:product failReason:@"Payment canceled"];

    } else {

        [_metricsManager logFailIAP:product failReason:error.localizedDescription];

    }

    if ([_delegate respondsToSelector:@selector(didSucceedPurchasingProduct:)]) {

        [_delegate didFailPurchasingProduct:product];

    }

}

 

---- inside logFailIAP:

          

  if (failReason != nil && failReason.length > 0) {

        [metricsDictionary setObject:failReason forKey:MetricsEventParameterFailReason];

    }

 

-------

 

My question is: is there any case where, you get "SKPaymentTransactionStateFailed" but, have an empty error.localizedDescription? My guess is, this is caused by a faulty internet connection, but I can't be sure, because Apple does not list the possible errors.


View the original article here

0 comments:

Post a Comment