在ios中将字符串编码为Normal字符串?

时间:2013-07-18 05:48:05

标签: ios objective-c nsstring in-app-purchase

当我从itunes获取产品列表时,使用以下方法连接我的应用内购买应用。

   - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {

    NSLog(@"Loaded list of products...");
    _productsRequest = nil;

    NSArray * skProducts = response.products;
    NSLog(@"naveen =0%@",skProducts[0]);
    for (SKProduct * skProduct in skProducts) {
        NSLog(@"Found product: %@ %@ %0.2f",
              skProduct.productIdentifier,
              skProduct.localizedTitle,
              skProduct.price.floatValue);
    }

    _completionHandler(YES, skProducts);
    _completionHandler = nil;

}

在这个方法中,我尝试使用NSLog(@"naveen =0%@",skProducts[0]);

打印第一个产品

我对这个NSLog的关注是

naveen = 0 SKProduct:0x7343d50

请帮忙

1 个答案:

答案 0 :(得分:1)

Navi试试这个。检查注释行之间的代码

   - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {

    NSLog(@"Loaded list of products...");
    _productsRequest = nil;

    NSArray * skProducts = response.products;
   ////////////////////////////////////////  EDIT //////////////////////////////
    SKProduct * product = (SKProduct *)skProducts[0];

     NSLog(@"naveen =0%@",product.localizedTitle);
   ////////////////////////////////////////////////////////////////////////////
    for (SKProduct * skProduct in skProducts) {
        NSLog(@"Found product: %@ %@ %0.2f",
              skProduct.productIdentifier,
              skProduct.localizedTitle,
              skProduct.price.floatValue);
    }

    _completionHandler(YES, skProducts);
    _completionHandler = nil;

}