I am creating an instance of an Objective C class from a C++ instance. The problem is that when trying to get the values of some vars (in the obj c instance) I always get 0. Some NSLogs are also ignored!:
Objective C class: InAppPurchaseManager.h
@interface InAppPurchaseManager : NSObject <SKProductsRequestDelegate, SKPaymentTransactionObserver>{
SKProduct *proUpgradeProduct;
SKProductsRequest *productsRequest;
@public
int finishedPurchaseProcess;
}
- (int)hasFinishedPurchaseProcess;
- (void)purchase;
@end
InAppPurchaseManager.m
@implementation InAppPurchaseManager
- (void)purchase{
finishedPurchaseProcess=1;
}
- (int)hasFinishedPurchaseProcess{
NSLog(@"STORE: HELLO THERE");
return finishedPurchaseProcess;
}
testApp.h class testApp : public ofxiPhoneApp { public: void goToStoreFromMenu(); void checkPurchase(); InAppPurchaseManager * theStore; }
testApp.mm
// First I call ghis function
void testApp::goToStoreFromMenu(){
InAppPurchaseManager* theStore = [[InAppPurchaseManager alloc] init];
[theStore purchase];
}
// And then this function
void testApp::checkPurchase(){
cout << "Finished? " << [theStore hasFinishedPurchaseProcess] << "\n";
}
and the result is always Finished? 0, even if I set it to 1 in purchase. Also the NSLog(@"STORE: HELLO THERE"); is ignored
I don't understand what's going on
InAppPurchaseManager*intestApp::goToStoreFromMenu?