: 나는에서 앱 구매를 테스트하기 위해 몇 사람을 물어에 성공있어아이폰 3G 4.2.1 - SKProductsRequest의 대리자 메서드가 호출되지
iPhone 3G를 제외한 모든 기기 (4.2.1 실행 - 다른 iOS 버전에서는 테스트하지 않음) 내가 가지고있는 장치에서 디버깅을 시도했지만 SKProductsRequest 대리자 메서드가 호출되지 않는 것으로 보입니다. 내 코드는 다음과 같습니다.
- (void)requestPurchaseOfCompetition:(Competition*)competition {
DLog("");
if ([SKPaymentQueue canMakePayments]) {
DLog(@"do store");
NSString* productIdentifier = [NSString stringWithFormat:@"%@%@_%@", kPRODUCT_IDENTIFIER_PREFIX, competition.competitionId, competition.season];
SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObject:productIdentifier]];
[[NSNotificationCenter defaultCenter] postNotificationOnMainThread:[NSNotification notificationWithName:kStoreKitHandlerNotificationRequestProductInfo object:nil userInfo:[NSDictionary dictionaryWithObject:request forKey:@"request"]]];
request.delegate = self;
[request start];
[request release];
} else {
DLog(@"no store");
// Warn the user that purchases are disabled.
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Store", @"Store") message:NSLocalizedString(@"In app purchasing is disabled for this device (in Settings > General > Restrictions). Please enable this setting to purchase more competitions.", @"In app purchasing is disabled for this device (in Settings > General > Restrictions). Please enable this setting to purchase more competitions.") delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
}
...
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
DLog(@"response: %@", response);
DLog(@"invalid product identifiers: %@", response.invalidProductIdentifiers);
for (SKProduct *product in response.products) {
DLog(@"product: %@", product);
[[NSNotificationCenter defaultCenter] postNotificationOnMainThread:[NSNotification notificationWithName:kStoreKitHandlerNotificationGotProductInfo object:nil userInfo:[NSDictionary dictionaryWithObject:product forKey:@"product"]]];
SKPayment *payment = [SKPayment paymentWithProduct:product];
SKPaymentQueue *paymentQueue = [SKPaymentQueue defaultQueue];
[paymentQueue addTransactionObserver:self];
[paymentQueue addPayment:payment];
}
}
- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {
DLog(@"request failed: %@, %@", request, error);
[[NSNotificationCenter defaultCenter] postNotificationOnMainThread:[NSNotification notificationWithName:kStoreKitHandlerNotificationRequestProductInfoFailed object:nil userInfo:[NSDictionary dictionaryWithObject:error forKey:@"error"]]];
}
- (void)requestDidFinish:(SKRequest *)request {
DLog(@"request finished: %@", request);
}
세 대리자 메서드의 로그 메시지가 나타나지 않습니다.
이것은 3GS, iPhone 4, iPad 등에서는 잘 작동하지만 4.2.1에서는 iPhone 3G에서 작동하지 않습니다.
아무도 통찰력을 제공 할 수 있습니까?
감사 @Matej Balantič 같은 일이하고 수정 좋았어요. –