Skip to content

Commit

Permalink
Don't use the deprecated JSONRepresentation.
Browse files Browse the repository at this point in the history
In SBJson 3.2, JSONRepresentation is being deprecated, so preemptively stop
using it.
  • Loading branch information
jorgenpt committed Feb 25, 2013
1 parent 2782401 commit 994d93d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ObjectiveMetrics/DMRequester.m
Expand Up @@ -71,13 +71,15 @@ - (NSString *)userAgent

- (BOOL)send:(NSArray *)events
{
NSData *json = [[events JSONRepresentation] dataUsingEncoding:NSUTF8StringEncoding];
SBJsonWriter *writer = [[[SBJsonWriter alloc] init] autorelease];
NSData *json = [writer dataWithObject:events];
NSMutableURLRequest *sentRequest = [self.request copy];

[sentRequest setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[json length]] forHTTPHeaderField:@"Content-Length"];
[sentRequest setHTTPBody:json];

DLog(@"Sending data: %@", [events JSONRepresentation]);
DLog(@"Sending data: %@", [[[NSString alloc] initWithData:json
encoding:NSUTF8StringEncoding] autorelease]);

NSURLResponse *response = nil;
NSError *error = nil;
Expand Down

0 comments on commit 994d93d

Please sign in to comment.