Trying to use the new Receipt Validation Programming of iOS and stopping at step 1

85 Views Asked by At

I am trying to switch from using the transactionReceipt to the receipt returned from the appStoreReceiptURL as in the Apple's: Receipt Validation Programming Guide

Yet I am stuck at compiling the output of the asn1c command. Apart from the host of angled references to header files I had to switch individually to quotes, there are a number of errors connected to features evidently not available on iOS. They seem to be connected to the finite() function and the DEBUG command. Here are two examples:

if(!finite(d)) { //solved with isfinite()

and

/* Debug output function */
static inline void
DEBUG(const char *fmt, ...) {
    va_list ap;
    if(!opt_debug) return;
    fprintf(stderr, "AD: ");
    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);
    fprintf(stderr, "\n");
 }

What should I substitute them with?

1

There are 1 best solutions below

0
Fabrizio Bartolomucci On

Ok, I managed the whole: the procedure encompassed:

1) changing most '<..>'includes to '"..."' (the compiler gives hints) 2) changing the name of function DEBUG to debug, what prompted "something" to turn it to:

void ASN_DEBUG_f(const char *fmt, ...);
void ASN_DEBUG_f(const char *fmt, ...) {
    va_list ap;
    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    fprintf(stderr, "\n");
    va_end(ap);
}

3) And finally remove the sample.c file containing another main function, and two README files.

Done those the program compiles without problems.