Created
October 2, 2014 00:59
-
-
Save ngs/902f0aeeea2417dc7347 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// StoreKitExampleViewController.swift | |
// StoreKitTest | |
// | |
// Created by Atsushi Nagase on 10/2/14. | |
// Copyright (c) 2014 Atsushi Nagase. All rights reserved. | |
// | |
import UIKit | |
import StoreKit | |
class ViewController: UIViewController, SKStoreProductViewControllerDelegate { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
@IBAction func buttonTapped(sender: AnyObject) { | |
var vc: SKStoreProductViewController = SKStoreProductViewController() | |
var params = [ | |
SKStoreProductParameterITunesItemIdentifier:451923559, | |
SKStoreProductParameterAffiliateToken:"10l87J", | |
SKStoreProductParameterCampaignToken:"onairlog813" | |
] | |
vc.delegate = self | |
vc.loadProductWithParameters(params, completionBlock: nil) | |
self.presentViewController(vc, animated: true) { () -> Void in } | |
} | |
func productViewControllerDidFinish(viewController: SKStoreProductViewController!) { | |
viewController.dismissViewControllerAnimated(true, completion: nil) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment