2013-03-12 45 views
1

我試圖在我的應用程序中實施應用程序內購買。該類型是非消耗品。 該產品的請求reuturns罰款..正確的標題,描述和價格。但是當我點擊購買時,打開alertView說「確認....環境:沙箱」,當我點擊確認時,應該出現用戶測試的請求密碼的蘋果盒..但它沒有出現而且傳輸失敗沒有消息錯誤...我的應用程序還沒有在AppStore中,並且Itunes Connect中的In App Purchase產品的狀態爲準備提交這是正確的?在應用程序購買 - 失敗的交易

這裏是我的代碼(對不起更長的代碼,但我的意思是它的相關性和對我的問題很重要)

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response 
{ 
NSArray *products = response.products; 
proUpgradeProduct = [products count] == 1 ? [[products firstObject] retain] : nil; 
if (proUpgradeProduct) 
{ 
    NSLog(@"Product title: %@" , proUpgradeProduct.localizedTitle); 
    NSLog(@"Product description: %@" , proUpgradeProduct.localizedDescription); 
    NSLog(@"Product price: %@" , proUpgradeProduct.price); 
    NSLog(@"Product id: %@" , proUpgradeProduct.productIdentifier); 

    //  lblTitulo.text = proUpgradeProduct.productIdentifier; 
    //  lblDescricao.text = proUpgradeProduct.localizedDescription; 

} 

for (NSString *invalidProductId in response.invalidProductIdentifiers) 
{ 
    NSLog(@"Invalid product id: %@" , invalidProductId); 
} 

// finally release the reqest we alloc/init’ed in requestProUpgradeProductData 
[productsRequest release]; 

[[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerProductsFetchedNotification object:self userInfo:nil]; 
} 
- (void)requestProUpgradeProductData 
{ 
NSSet *productIdentifiers = [NSSet setWithObject:@"versaopro" ]; 
productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers]; 
productsRequest.delegate = self; 
[productsRequest start]; 

// we will release the request object in the delegate callback 
} 
- (void)loadStore 
{ 
// restarts any purchases if they were interrupted last time the app was open 
[[SKPaymentQueue defaultQueue] addTransactionObserver:self]; 

// get the product description (defined in early sections) 
[self requestProUpgradeProductData]; 
} 

    - (void)purchaseProUpgrade 
{ 
SKPayment *payment = [SKPayment paymentWithProduct:proUpgradeProduct]; 
[[SKPaymentQueue defaultQueue] addPayment:payment]; 
    } 



-(IBAction) buyClick: (id) sender { 
[self purchaseProUpgrade]; 
    } 

回答

1

這裏是In App Purchase的示例代碼,他說得很清楚了,請跟隨此鏈接。我希望它可以幫助你
In App Purchase

+0

問題是,我需要從我的iPhone App Store上註銷,以便App從用戶測試請求密碼。多謝!我會接受你的回答,因爲我在你的鏈接中讀到了這個。 – Ladessa 2013-03-12 13:23:02

+0

歡迎和感謝 – 2013-03-12 13:44:45

相關問題