• This repository has been archived on 11/Aug/2020
  • Stars
    star
    139
  • Rank 262,954 (Top 6 %)
  • Language
    Objective-C
  • License
    Other
  • Created almost 12 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Yet Another simple in-app purchase interface

IAPManager

Yet Another simple in-app purchase interface for iOS.

A simple toolkit for non-renewables (a.k.a "Premium Features") with In-App Purchase. The main goal is ease of use. Therefore, more complicated parts, like checking of receipts, are not provided.

Features

  • Simple setup
  • Efficient one-line check if a product was purchased
  • SKProducts to obtain prices
  • Restoring purchases
  • Uses block for callbacks

Requirements

iOS 5 or above with ARC and StoreKit.framework.

How-to

  1. Create your purchases in iTunes Connect. For details see the In-App Purchase Programming Guide.
  2. Add StoreKit.framework to your project
  3. Add IAPManager.h and IAPManager.m into your project, or use the Pod IAPManager.
  4. Create your IAP UI
  5. Use the methods of the [IAPManager sharedIAPManager] singleton:
    • Check if the App Store is available: [[IAPManager sharedIAPManager] canPurchase]
    • To obtain product information:
[[IAPManager sharedIAPManager] getProductsForIds:@[@"superpremiumversion"]
                                      completion:^(NSArray *products) {
                                          BOOL hasProducts = [products count] != 0;
                                          if(! hasProducts) {
                                              NSLog(@":(");
                                          }
                                          else {
                                              SKProduct *premium = products[0];
                                          
                                              NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];                                                                                                                 [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
                                              [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
                                              [numberFormatter setLocale:premium.priceLocale];
                                              NSString *formattedPrice = [numberFormatter stringFromNumber:premium.price];
                                              NSLog(@"super premium: %@ for %@", premium.localizedTitle, formattedPrice);
                                          }
}];
- To purchase a product:
[[IAPManager sharedIAPManager] purchaseProductForId:@"superpremiumversion"
                                         completion:^(SKPaymentTransaction *transaction) {
                                             [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
                                             UIAlertView *thanks = [[UIAlertView alloc] initWithTitle:@"Thanks!"
                                                                                              message:@"The extra features are now available"
                                                                                             delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
                                             [thanks show];
                                         } error:^(NSError *err) {
                                             [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
                                         
                                             NSLog(@"An error occured while purchasing: %@", err.localizedDescription);
                                             // show an error alert to the user.
                                         }];
  StoreKit will then ask the user if they want to purchase the product.

Contact

Travis CI build status FOSSA Status

Bug reports and pull requests are welcome! Contact me via e-mail or just by opening an issue on GitHub.

License

FOSSA Status

More Repositories

1

ios-linechart

Interactive linecharts for the simplicity-loving iOS developer.
Objective-C
449
star
2

objc-utils

Utilities for developing ObjC, particularly under iOS
Objective-C
142
star
3

HoudiniFlatThemes

Flat themes for Houdini
36
star
4

uiview-hierarchical-drawing

Draw UIView hierarchy manually, for crisp rendering of PDFs from views in iOS
Objective-C
32
star
5

mrAiVexShader

Houdini VEX/CVEX shader for Arnold
C++
30
star
6

mrAiHouOceanShader

Shader to render Houdini ocean spectra natively in Arnold
C++
27
star
7

objc-simple-bindings

A simple bindings mechanism for Objective-C
Objective-C
21
star
8

CDJSONExporter

Conversion of a Core Data Store to/from JSON.
Objective-C
15
star
9

ios-NumberRangeSelector

Granular selection from a numeric range for iOS.
Objective-C
13
star
10

ofxPoissonDiskSampling

Poisson Disk Sampling for openFrameworks.
C++
13
star
11

ofxDelaunay2D

2D Delaunay triangulation of a set of points for OpenFrameworks
C++
11
star
12

houdini-principal-curvature

Houdini SOP for principal curvature directions
C++
7
star
13

Hs-Game

A Haskell library for basic game theory
Haskell
7
star
14

ofxGpuThicklines

Thick line drawing on the GPU for openFrameworks.
C++
7
star
15

uikit-utils

Utilities for UIKit
Objective-C
7
star
16

houdini-transform-matcher

A Houdini DSO that extracts the transform between two sets of points.
C++
6
star
17

ofxGpuCurves

openFrameworks addons to render large amounts of Catmull-Rom splines on the GPU
C++
5
star
18

CoreDataValidation

Validation for Core Data objects
Objective-C
4
star
19

Delaunay

Generates a Delaunay triangulation of a set of points
Haskell
2
star
20

ios-versioncheck

Quick, cached version checking for iOS
Objective-C
2
star
21

ios-notificationmanager

Sane management of local notifications
Objective-C
1
star
22

blaze-html-truncate

A HTML truncator for Haskell
Haskell
1
star
23

PHCPack-hs

A simple Haskell wrapper of the PHCPack solver for polynomial systems
Haskell
1
star
24

HOpenVGRaw

OpenVG / ShivaVG bindings
Haskell
1
star
25

miWorleyNoise

Worley noise / Voronoi noise shader for mental ray
C
1
star