IAPShare.m
1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// IAPShare.m
// inappPurchasesTest
//
// Created by Htain Lin Shwe on 10/7/12.
// Copyright (c) 2012 Edenpod. All rights reserved.
//
#import "IAPShare.h"
#if ! __has_feature(objc_arc)
#error You need to either convert your project to ARC or add the -fobjc-arc compiler flag to IAPShare.m.
#endif
@implementation IAPShare
@synthesize iap= _iap;
+ (IAPShare *) sharedHelper {
static IAPShare * _sharedHelper = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedHelper = [[IAPShare alloc] init];
_sharedHelper.iap = nil;
});
return _sharedHelper;
}
+(id)toJSON:(NSString *)json
{
NSError* e = nil;
id jsonObject = [NSJSONSerialization JSONObjectWithData: [json dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: &e];
if(e==nil) {
return jsonObject;
}
else {
NSLog(@"%@",[e localizedDescription]);
return nil;
}
}
@end