Created
September 18, 2013 07:52
-
-
Save objectiveSee/6605956 to your computer and use it in GitHub Desktop.
Xcode5 is saying Socket.IO uses private selectors
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
+ (id) objectFromJSONData:(NSData *)data error:(NSError **)error { | |
Class serializer; | |
// try SBJson first | |
serializer = NSClassFromString(@"SBJsonParser"); | |
if (serializer) { | |
id parser; | |
id object; | |
parser = [[serializer alloc] init]; | |
object = [parser objectWithData:data]; | |
return object; | |
} | |
// try Foundation's JSON coder, available in OS X 10.7/iOS 5.0 | |
serializer = NSClassFromString(@"NSJSONSerialization"); | |
if (serializer) { | |
return [serializer JSONObjectWithData:data options:0 error:error]; | |
} | |
// lastly, try JSONKit | |
serializer = NSClassFromString(@"JSONDecoder"); | |
if (serializer) { | |
return [[serializer decoder] objectWithData:data]; | |
} | |
// unable to find a suitable JSON deseralizer | |
[NSException raise:SocketIOException format:@"socket.IO-objc requires SBJson, JSONKit or an OS that has NSJSONSerialization."]; | |
return nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment