我正在使用已弃用的API,我想更新我的代码以使用非depcreated代码。
所以我的大问题是如何获得回复列表?
cat input.txt | ./calculate.sh > output.txt
aryProductIDs在(id)init
下定义- (void) buyFeature:(NSString*) featureId
{
// SKProduct *myProduct;
if ([SKPaymentQueue canMakePayments])
{
SKPayment *payment = [SKPayment paymentWithProductIdentifier:featureId];
// SKPayment *payment = [SKPayment paymentWithProduct:myProduct];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
else
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"purchaseDone" object:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"You are not authorized to purchase from AppStore"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
}
- (void) purchase: (int) productIndex {
[self buyFeature: [aryProductIDs objectAtIndex: productIndex]];
}
我不确定myProduct的用途(类型SKProduct)。
我见过很多使用NSSet代替NSMutableArray的例子。不确定我是否需要更改
答案 0 :(得分:1)
首先,您需要获取所有产品的产品信息:
<%# app/views/users/_modal_wrapping.html.erb %>
<div id='modal'>
<%= simple_form_for @user do |f| %>
<%= yield f %>
<% end %>
</div>
您将获得委托回调。您可能希望使用响应创建字典:
NSSet *productsToRequest = [NSSet setWithArray:aryProductIDs];
SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:productsToRequest];
request.delegate = self;
[request start];
您可能希望查看回复并检查是否还有- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
for (SKProduct *product in response.products)
{
dict[product.productIdentifier] = product;
}
self.products = dict;
}
,但这是基本想法。