VerifyStoreReceiptiOS icon indicating copy to clipboard operation
VerifyStoreReceiptiOS copied to clipboard

Linker error when including VerifyStoreReceipt.h into .mm

Open gabortoth opened this issue 11 years ago • 4 comments

if you include VerifyStoreReceipt.h into an AppDelegate.mm the linking will fail with this message:

Undefined symbols for architecture armv7: "verifyReceiptAtPath(NSString*)", referenced from: -[AppDelegate validateReceipt:tryAgain:] in AppDelegate.o ld: symbol(s) not found for architecture armv7

Other architectures fail also. This can easily be reproduced by changing the example projects appdelegates file extension from .m to .mm

gabortoth avatar Feb 24 '14 15:02 gabortoth

I resolved the issue by modifying VerifyStoreReceipt.h as follows:

#ifdef __cplusplus extern "C" { #endif BOOL verifyReceiptAtPath(NSString *receiptPath); #ifdef __cplusplus } #endif

relliott2014 avatar May 07 '14 15:05 relliott2014

You could pull out any c++ code in appdelegate.mm into another objective-c .mm file and then rename the main one. On May 7, 2014 8:00 AM, "relliott2014" [email protected] wrote:

My appdelegate.mm cannot be renamed back to .m. Is there a recommended workaround?

Reply to this email directly or view it on GitHubhttps://github.com/rmaddy/VerifyStoreReceiptiOS/issues/5#issuecomment-42437969 .

fadookie avatar May 07 '14 16:05 fadookie

Thanks for your response!

I'm sure thats an option but not a simple task in our case... Maybe for others however...

relliott2014 avatar May 07 '14 18:05 relliott2014

Maybe you could create a simple wrapper class for the library that's a .m file and call that from your appdelegate instead of including the library directly? Make sure that you don't import the library in the header of that file, just in the implementation, to keep things separated at the compilation stage.

On Wed, May 7, 2014 at 11:04 AM, relliott2014 [email protected]:

Thanks for your response!

I'm sure thats an option but not a simple task in our case... Maybe for others however...

Reply to this email directly or view it on GitHubhttps://github.com/rmaddy/VerifyStoreReceiptiOS/issues/5#issuecomment-42461481 .

fadookie avatar May 07 '14 19:05 fadookie