0

To set up Receipt-Validation in my iOS app, I am now following this tutorial: https://www.raywenderlich.com/9257-in-app-purchases-receipt-validation-tutorial and reading at this point: Loading the Receipt.

While reading and attempting to understand what is going on I also try to integrate the code in my own app, by doing so getting a hands-on understanding of the process.

Here is one problem I am hitting at this moment:

On this line of code:

private func loadReceipt() -> UnsafeMutablePointer<PKCS7>? {

I get this error message:

Use of undeclared type 'PKCS7'

After searching the net and trying a few things, I guess it is related to the use of the use of the ReceiptVerifier-Bridging-Header.h file. But I am not sure how to set it in the project.

I will be glad if anyone has some tip allowing me to move forward. Thanks in advance!

In case this can be useful, here is the meaningful contents of the bridging header file (ReceiptVerifier-Bridging-Header.h):

#import <openssl/pkcs7.h>
#import <openssl/objects.h>
#import <openssl/evp.h>
#import <openssl/ssl.h>
#import <openssl/asn1_locl.h>
Michel
  • 10,303
  • 17
  • 82
  • 179
  • The `PKCS7` is defined in the OpenSSL library (which should be included in the sample project from that site). You probably have to `#include ` in the bridging header file. – Martin R Mar 30 '19 at 03:00
  • Thanks, I have updated my post and as you can see, I already have a bridging header containing the file you mention. But I think it is not set up as it should. That probably explain why I am having this issue. – Michel Mar 31 '19 at 02:52

1 Answers1

0

The problem is that I had simply copied the bridge-header file, without doing the proper setting as explained here: https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift

Michel
  • 10,303
  • 17
  • 82
  • 179