0
我試圖在應用程序購買中的iPhone中實現我的應用程序。SKProduct productIdentifier發送到實例的無法識別的選擇器
我有一個按鈕的IBAction爲買一個小遊戲:
-(IBAction) buyGame:(id)sender {
SKProduct *product = [[InAppGameIAHelper sharedHelper].products objectAtIndex:0];
NSLog(@"Buying %@...", product.productIdentifier);
[[InAppGameIAHelper sharedHelper] buyProductIdentifier:product.productIdentifier];
self.hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
_hud.labelText = @"Buying...";
[self performSelector:@selector(timeout:) withObject:nil afterDelay:60*5];
}
[InAppGameIAHelper sharedHelper]允許從商店加載項,並加載產品列表。
[InAppGameIAHelper sharedHelper]。產品是一個的NSArray:
products (
"com.me.myapp"
)
有當我敲擊購買按鈕我的應用程序得到墜毀,得到以下錯誤:
2013-03-04 20:24:50.314 isam[11922:c07] -[__NSCFConstantString productIdentifier]: unrecognized selector sent to instance 0x22ae30
2013-03-04 20:24:50.318 isam[11922:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString productIdentifier]: unrecognized selector sent to instance 0x22ae30'
是的,你是對的,[[InAppGameIAHelper sharedHelper] .products objectAtIndex:0]是一個__NSCFConstantString。我不知道如何在SKProduct中進行轉換。 – cmii 2013-03-05 18:52:42
嗯狡猾。你做了你的幫手的代碼嗎?因爲基本上你必須修改該代碼 – 2013-03-05 22:46:19
嘿,如果你可以選擇這個答案作爲正確的答案,它會幫助我很多。謝謝。 – 2013-03-06 15:19:30