Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt5.4: Calling objective C method to retrieve StoreKit in app purchases / products.

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 884 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nando76
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nando76
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved