使用parse.com添加应用内购买

时间:2014-03-28 08:35:57

标签: ios in-app-purchase parse-platform icarousel

我正在使用parse.com作为后端开发卡应用程序,该应用程序适用于免费卡,我可以显示所有卡并点击任何卡以获得完整视图,以便客户可以编写文本并自定义并发送给朋友

我的问题是如何向应用添加高级卡,以便客户在使用它并发送给朋友之前需要先购买。是否可以在同一视图中显示免费卡和高级卡,并在高级卡上添加价格标签?

我正在使用Carousol显示所有卡片以及显示卡的代码

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
    self.cardFileArray = [[NSMutableArray alloc] init];


    //create new view if no view is available for recycling

       view = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 250.0f, 350.0f)] autorelease];


       PFQuery *query = [PFQuery queryWithClassName:WALL_OBJECT3];

        query.cachePolicy = kPFCachePolicyCacheOnly;



        [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
            if (!error) {

                cardFileArray = [[NSMutableArray alloc] initWithArray:objects];
                PFObject *object = [cardFileArray objectAtIndex:index];
                PFFile *file = [object objectForKey:KEY_IMAGE4];

                [file getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
                    if (!error) {

                        ((UIImageView *)view).image = [UIImage imageWithData:data];


                    }
                }];
            }
        }];



    }

这是客户选择卡片进行预览和编辑时的代码

-(void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index{


    PFObject *object = [cardFileArray objectAtIndex:index];
    PFFile *file = [object objectForKey:KEY_IMAGE5];
    NSString *tmpObject = [NSString stringWithFormat:@"%@",object.objectId];

     [HUD showUIBlockingIndicatorWithText:@"Loading Card"];

    [file getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
        if (!error) {


            CardDetailsViewController*ptvc = [self.storyboard instantiateViewControllerWithIdentifier:@"cardsDetail"];

            [self.navigationController pushViewController:ptvc animated:YES];

            ptvc.ImageForDetail = [UIImage imageWithData:data];

            ptvc.imageString = tmpObject;
            ptvc.title = title2;

            [HUD hideUIBlockingIndicator];

        }
    }];

}

您能帮我解决如何将应用内购买添加到我的应用

的问题

感谢

1 个答案:

答案 0 :(得分:0)

是的,有可能。您需要保存卡的类型(免费/高级)或仅在您从查询中获取的数据的代码中保存价格。然后,根据它的状态,您可以在-viewForItemAtIndex方法中对图像应用标签。

至于实施应用内购买,您应该阅读here