IOS-add an in-App purchase & amp; to verify the new features of iOS7

Source: Internet
Author: User

In-APP purchase

(Nonconsumable) If you buy it, you will have the title and function (Consumable). If you buy it, you will use it. If you use it, you will not have it.

 

 

Product defined

 

 

 

Products defined

# Define kIAPBomb @ "airplay.10bombs"

# Define kIAPBullet @ "airplay. laserBullet"

1. when instantiating a request, you must specify a valid identifiers set. The reason for this is to ensure that the submitted inner-purchased items have been approved by Apple and are available!

2. To obtain an accurate set of available products, you must use the proxy method.

3. the jailbreak user cannot test the in-house purchase, but can purchase

  ITViewController () <SKProductsRequestDelegate, SKPaymentTransactionObserver>           NSMutableDictionary * }
 - (                    }

 

 

  

Mark asks Apple's server which products can be sold-(NSSet * = SKProductsRequest * request = [[SKProductsRequest alloc] initWithProductIdentifiers: =

 

- ()productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse * (_productDict === (SKProduct *product         NSLog(==

 

Mark-the user decides to purchase the product-() buyProduct :( SKProduct * SKPayment * payment =}
 -     - (IBAction)purchaseBomb:(   }

 

 

Mark-SKPaymentTransaction Observer mark changes in the purchase queue status-() paymentQueue :( SKPaymentQueue *) queue updatedTransactions :( NSArray * (SKPaymentTransaction * transaction (SKPaymentTransactionStatePurchased = (Signature =

 

Mark-Restore product -(

 

 

Mark to verify the purchase Credential-(NSURL * receiptURL = NSData * receiptData = NSURL * url = NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL: url cachePolicy: Invalid timeoutInterval: request. HTTPMethod = NSString * encodeStr = NSString * payload = [NSString stringWithFormat: receept-data \ NSData * payloadData = request. HTTPBody = NSData * result = (result = NSLog (NSDictionary * d Ict = NSLog (dict! = NSLog (}

------

----------

--

 

 

Clear Saup

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.