This is a follow-up question to \"In app purchases with MKStoreKit failing: “Problem in iTunes connect configuration for product: xxx\"
I am having a similar issue a
I was testing the newest version of my existing, fully-functioning app with in app-purchase to ensure the functionality was still working as expected, when I began to seeing the problems in iTunes connect message. My problem was (I forgot) that MKStoreKit stored the fact of the purchase on my various devices' keychain, so even though I was using a new user account, my keychain was registering the device as already purchased. [self removeAllKeychainData] from within MKStoreManager fixed the trouble. Hope this saves someone some frustration.
After 2 days of waiting, new app ids, profiles, etc. this fixed it for me..
Why do the docs say to use the full com.iap.isrubbish syntax?
Thanks for your help
I replaced:
define kMySubscriptionFeature @"uk.co.somesite.someapp.sub1"
with:
define kMySubscriptionFeature @"sub1"
I think I've done it now. I'm going to run some tests just to make sure.
This is not going to be accepted just yet; I am running some tests with different storekit frameworks.
My output:
2011-10-27 15:17:49.297 My Simple App[7376:707] productsRequest
2011-10-27 15:17:49.298 My Simple App[7376:707] Product title: Simple subscription
2011-10-27 15:17:49.299 My Simple App[7376:707] Product description: Subscribe and get the latest content to your iPhone or iPod Touch device
2011-10-27 15:17:49.299 My Simple App[7376:707] Product price: 2.99
2011-10-27 15:17:49.300 My Simple App[7376:707] Product id: sub1
Here's what I did.
I added my bank details. I still do not think this has anything to do with it though.
Note. The app's in-app purchase is still "Waiting for review" and I got the above output.
I replaced:
#define kMySubscriptionFeature @"uk.co.somesite.someapp.sub1"
with:
#define kMySubscriptionFeature @"sub1"
I am going to run some tests with MKStoreKit and with other frameworks to see if it is okay.
The code I used is below, edited for security reasons:
.h file
// ManageSubscriptionsVC.h
// This doesn't have visual output, just NSLog at the moment
// This doesn't use MKStoreKit yet
#import <UIKit/UIKit.h>
#import "StoreKit/StoreKit.h"
#define kMySubscriptionFeature @"sub1"
/*
Shared Secret
A shared secret is a unique code that you should use when you make the
call to our servers for your In-App Purchase receipts.
Without a shared secret, you will not be able to test auto-renewable
In-App Purchase subscriptions in the sandbox mode.
Also note that you will not be able to make them available
on the App Store.
Note: Regardless of what app they are associated with,
all of your auto-renewable subscriptions will use this
same shared secret.
*/
#define sharedSecret @"PUTSHAREDSECRETHERE"
@interface ManageSubscriptionsVC : UIViewController
<SKProductsRequestDelegate, SKProductsRequestDelegate, SKPaymentTransactionObserver>
{
SKProduct *proUpgradeProduct;
SKProductsRequest *productsRequest;
}
- (void)requestProUpgradeProductData;
@end
.m file
//
// ManageSubscriptionsVC.m
#import "ManageSubscriptionsVC.h"
@implementation ManageSubscriptionsVC
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.title = @"Manage Subscriptions";
if ([SKPaymentQueue canMakePayments])
{
// Display a store to the user.
//[MKStoreManager sharedManager];
//NSLog(@"purhcasable = %@", [[MKStoreManager sharedManager] purchasableObjectsDescription] );
[self requestProUpgradeProductData];
}
else
{
// Warn the user that purchases are disabled.
NSString *message = @"In-app purchases are disabled. Please review your settings";
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
} // end if
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - StoreKit Delegate
- (void) requestProductData
{
NSLog(@"requestProductData");
SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObject:kMySubscriptionFeature]];
request.delegate = self;
[request start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSLog(@"productsRequest");
NSArray *myProduct = [[NSArray alloc] initWithArray:response.products];
for(SKProduct *item in myProduct)
{
NSLog(@"Product title: %@" , item.localizedTitle);
NSLog(@"Product description: %@" , item.localizedDescription);
NSLog(@"Product price: %@" , item.price);
NSLog(@"Product id: %@" , item.productIdentifier);
}
/*
for(NSString *invalidProduct in response.invalidProductIdentifiers)
NSLog(@"Problem in iTunes connect configuration for product: %@", invalidProduct);
*/
for (NSString *invalidProductId in response.invalidProductIdentifiers)
{
NSLog(@"Problem in iTunes connect configuration for product: %@" , invalidProductId);
}
[myProduct release];
// populate UI
[request autorelease];
}
#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
{
}
#pragma mark - Other
- (void)requestProUpgradeProductData
{
NSSet *productIdentifiers = [NSSet setWithObject:kMySubscriptionFeature];
productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
productsRequest.delegate = self;
[productsRequest start];
// we will release the request object in the delegate callback
}
@end
I just found out that I swapped the product ID and the reference name when I created the in app purchase, so in my case I was using the wrong string to try and find the Product... Hard to spot.
My issue was, I had logged in on device using real apple id. Then signed out ( Iphone-> Settings -> App Store -> My ID-> Sign Out) Then deployed again, and hurray it worked.
Thanks everyone on web.