Skip to content

Instantly share code, notes, and snippets.

@binderclip
Created March 20, 2015 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binderclip/aaccf5f6b79bcdec9d2d to your computer and use it in GitHub Desktop.
Save binderclip/aaccf5f6b79bcdec9d2d to your computer and use it in GitHub Desktop.
OC 中单例的实现
#import "RageIAPHelper.h"
@implementation RageIAPHelper
+ (RageIAPHelper *)sharedInstance {
static dispatch_once_t once;
static RageIAPHelper * sharedInstance;
dispatch_once(&once, ^{
NSSet * productIdentifiers = [NSSet setWithObjects:
@"pw.xkk.inapprangewythest.nightlyrage",
@"pw.xkk.inapprangewythest.drummerrage",
@"pw.xkk.inapprangewythest.randomrageface",
nil];
sharedInstance = [[self alloc] initWithProductIdentifiers:productIdentifiers];
});
return sharedInstance;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment