Skip to content

Commit

Permalink
Merge pull request j3k0#419 from steffanolesen/feature/json_fix
Browse files Browse the repository at this point in the history
Use apple json library instead of depending on JSONKit or SBJson
  • Loading branch information
j3k0 committed Mar 9, 2016
2 parents 99ff557 + 70a53a7 commit b15e9ee
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/ios/InAppPurchase.m
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,10 @@ static NSInteger jsErrorCode(NSInteger storeKitErrorCode)
}
*/

// To avoid compilation warning, declare JSONKit and SBJson's
// category methods without including their header files.
@interface NSArray (StubsForSerializers)
- (NSString *)JSONString;
- (NSString *)JSONRepresentation;
@end

// Helper category method to choose which JSON serializer to use.
@interface NSArray (JSONSerialize)
- (NSString *)JSONSerialize;
@end

@implementation NSArray (JSONSerialize)
- (NSString *)JSONSerialize {
return [self respondsToSelector:@selector(JSONString)] ? [self JSONString] : [self JSONRepresentation];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:0 error:nil];
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
@end

Expand Down

0 comments on commit b15e9ee

Please sign in to comment.