Qt5.4: Calling objective C method to retrieve StoreKit in app purchases / products.



  • Hi,

    threw a static method i call an objective c object which then should retrieve all configured in app purchases from apple.

    i use the demo code like this:

    @
    #define FULL_PACKAGE_INAPP_PRODUCT_ID @"test.purchases.fullpackage"

    @interface MacAppStoreAPIDelegate : NSObject <SKProductsRequestDelegate>
    {
    SKProductsRequest *productRequest;
    NSMutableArray *productDetailsList;
    }

    • (void)getAvailableProducts;

    @end

    @implementation MacAppStoreAPIDelegate

    -(void)getAvailableProducts
    {
    NSLog(@"MacAppStoreAPI::getAvailableProducts");

    NSSet *productIdentifiers = [NSSet
                                 setWithObjects:FULL_PACKAGE_INAPP_PRODUCT_ID,nil];
    productRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
    productRequest.delegate = self;
    [productRequest start];
    

    }
    @

    Here my C++ static method:
    @
    void MacAppStoreAPI::requestProductInformation()
    {
    NSLog(@"MacAppStoreAPI::requestProductInformation");

    MacAppStoreAPIDelegate* appStore = [[MacAppStoreAPIDelegate alloc] init];
    
    [appStore getAvailableProducts];
    
    NSLog(@"MacAppStoreAPI::requestProductInformation: END");
    

    }
    @

    This always crashs after calling

    @
    [productRequest start];
    @

    @[53694:935054] *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]
    2014-12-01 20:31:32.137 MyApp[53694:935054] (
    0 CoreFoundation 0x00007fff90a5b64c __exceptionPreprocess + 172
    1 libobjc.A.dylib 0x00007fff90cb56de objc_exception_throw + 43
    2 CoreFoundation 0x00007fff909489bf -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 383
    3 CoreFoundation 0x00007fff9095e6ab +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
    4 StoreKit 0x000000010088e1d4 -[SKServiceProxy serviceConnection] + 613
    5 StoreKit 0x000000010088e394 -[SKServiceProxy objectProxyWithErrorHandler:] + 33
    6 StoreKit 0x0000000100893ce2 -[SKProductsRequest issueRequestForIdentifier:] + 97
    7 StoreKit 0x0000000100894719 -[SKRequest start] + 163
    8 AVIATOReLogbook 0x0000000100270b71 -[MacAppStoreAPIDelegate getAvailableProducts] + 209
    9 AVIATOReLogbook 0x0000000100270d70 _ZN14MacAppStoreAPI25requestProductInformationEv + 96
    10 AVIATOReLogbook 0x000000010042b994 _ZN11MacAppStore9showEventEP10QShowEvent + 68
    11 QtWidgets 0x000000010097f502 _ZN7QWidget5eventEP6QEvent + 2194
    12 QtWidgets 0x000000010093fdbb _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent + 251
    @

    Any ideas?

    Greetings
    Nando



  • Exactly the same code works when compiling with xcode....
    Any ideas whats different?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.