开发者

in app purchase urban airship help

开发者 https://www.devze.com 2022-12-20 04:45 出处:网络
Hey evveryone, this is first time for me here, but not last i can see from all the good questions ans开发者_开发知识库wered here :D

Hey evveryone, this is first time for me here, but not last i can see from all the good questions ans开发者_开发知识库wered here :D

Here is my question: Im about ot make a new iphone app and would like to use In-App-purchase in it. Im a one man developer, so i dont have a server to hold all the packages, so urban airship is just something that fits me :) http://urbanairship.com/

I have tried there sample code, and seems pretty easy, i just cant figure out how to use the data you buy (download) with in-app purchase.

The user have a tableview with, lets say 6 rows, and when the user buy a package in the in app store, there needs to be added 4 more rows. When a user touch a row, lets say the background image will change. Is that possible? and is it easy?

Anyone have expirence with this? i cant seem to find a full sample code of an in app store (where u can download/buy packages, for testing).

Any help would be appreciated :D

  • Drudoo


When somebody buys something, the Urban Airship StoreFront will call you back with a productPurchased message; if you don't have any content to download, you could use that method to set a flag in your app.

More usually, you'll want to wait to unlock the new options in your app until the content has been downloaded and unzipped.

So say your extra four rows have files image7.png, image8.png, image9.png, image10.png that are the extra content you've downloaded: you can do something like this:

BOOL extraContentUnlocked;

- (void) checkForPurchases {

    NSString *docsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,                                        NSUserDomainMask, YES) 
                         objectAtIndex:0];

    extraContentUnlocked = [[NSFileManager defaultManager] fileExistsAtPath:[docsDir stringByAppendingString:@"/image10.png"]];
}

and then in your tableView code you can change how many rows there are based on the flag. (if the table view is showing while the extra content is downloading, you might want a timer to keep rechecking whether the new content has arrived so you can refresh the table at the appropriate time.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号