Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 19, 2013, 04:59 AM   #1
Nobita.ZZZ
macrumors newbie
 
Join Date: Jan 2012
Mac app In-app Purchase : Invalid product ID

Thanks for reading. I'm having problem with Mac app In-app Purchase.<br/>
I just setup Mac developer account with $99 subscription.<br/>
1) Go to Developer Certificate Utility, create App ID: com.mpham.TestIAP, create certificate, add my Mac ID to System list. Final, add Provisioning profile (development)<br/>
2) Go to iTunes connect, create App: com.mpham.TestIAP, create IAP: com.mpham.TestIAP.IAP1. Final, make app status to "Waiting For Upload"<br/>
3) I create simple Cocoa app: com.mpham.TestIAP, choose Code sign to com.mpham.TestIAP <br/>

Code:
    //
    //  AppDelegate.h
    //
    
    #import <Cocoa/Cocoa.h>
    #import <StoreKit/StoreKit.h>
    
    
    @interface AppDelegate : NSObject <NSApplicationDelegate, SKProductsRequestDelegate, SKProductsRequestDelegate, SKPaymentTransactionObserver>
    {
        SKProduct *proUpgradeProduct;
        SKProductsRequest *productsRequest;
    }
    
    @property (assign) IBOutlet NSWindow *window;
    @end

and

Code:
    //
    //  AppDelegate.m
    //
    
    #import "AppDelegate.h"
    
    #define k1 @"com.mpham.TestIAP.IAP1"
    #define k2 @"IAP1"
    
    
    @implementation AppDelegate
    
    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    {
        if ([SKPaymentQueue canMakePayments])
        {
            [self requestIAP1];
            [self requestIAP2];
            
        }
        
    
    }
    
    
    - (void)requestIAP1
    {
        NSLog(@"requestIAP1");
        NSSet *productIdentifiers = [NSSet setWithObject:k1];
        productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
        productsRequest.delegate = self;
        [productsRequest start];
        
    }
    - (void)requestIAP2
    {
        NSLog(@"requestIAP2");
        NSSet *productIdentifiers = [NSSet setWithObject:k2];
        productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
        productsRequest.delegate = self;
        [productsRequest start];
        
    }
    
    #pragma mark SKProductsRequestDelegate methods
    
    - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
    {
        NSArray *products = [[NSArray alloc] initWithArray:response.products];
        
        
        for(SKProduct *item in products)
        {
            NSLog(@"Product title: %@" , item.localizedTitle);
            NSLog(@"Product description: %@" , item.localizedDescription);
            NSLog(@"Product price: %@" , item.price);
            NSLog(@"Product id: %@" , item.productIdentifier);
        }
        
        for (NSString *invalidProductId in response.invalidProductIdentifiers)
        {
            NSLog(@"Invalid : %@" , invalidProductId);
        }
    }
    
    #pragma mark - PaymentQueue
    
    -(void)paymentQueue:(SKPaymentQueue *)queue removedTransactions:(NSArray *)transactions
    {
    }
    
    -(void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error
    {
    }
    
    -(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
    {
    }
    
    -(void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
    {
    }
    
    @end

It's run and show the log

Code:
    2013-02-18 16:59:14.948 TestIAP[12646:403] requestIAP1
    2013-02-18 16:59:14.951 TestIAP[12646:403] requestIAP2
    2013-02-18 16:59:15.939 TestIAP[12646:1b03] Invalid : IAP1
    2013-02-18 16:59:16.043 TestIAP[12646:1b03] Invalid : com.mpham.TestIAP.IAP1
It's mean there is Invalid product, but I created product in iTunesConnect, could anyone please help me?

Last edited by maflynn; Feb 19, 2013 at 12:10 PM. Reason: Changed quote tags to code tags
Nobita.ZZZ is offline   1 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Mac App Store refund... App disappears from Purchased list, but app still installable WolfSnap Mac Applications and Mac App Store 1 Jan 7, 2014 05:19 PM
Amazon Expands In-App Purchase API to Mac, PC, and Web Apps MacRumors MacRumors.com News Discussion 17 Apr 9, 2013 06:53 AM
iPad: Make iOS in-app purchase on a MAC waqas iOS 6 2 Apr 7, 2013 05:10 AM
How to set-up In App Purchase free trial period in iOS app mr-plef iPhone/iPad Programming 0 Sep 6, 2012 05:47 AM
Lost OS X Lion purchase in app store and iDentify app won't update Stonefly Mac Applications and Mac App Store 3 Jun 12, 2012 08:23 PM

Forum Jump

All times are GMT -5. The time now is 01:37 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC