Skip to content

Commit

Permalink
See #7. Fix bug in Adapter that JSON serializing query would always r…
Browse files Browse the repository at this point in the history
…esult in an error.

This bug was causing FindQuery requests to fail, and load all of the records (act like a FindAll without a query).
  • Loading branch information
Glavin001 committed Jul 29, 2014
1 parent a400e66 commit 61a9423
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Common/SLAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,17 @@ - (PMKPromise *) performRequestWithMethod:(SLHTTPMethodType)theMethod
// Payload
NSString *payload;
if (theParams != nil) {
NSError *error;
NSError *error = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:theParams
options:(NSJSONWritingOptions) 0
error:&error];
if (!error && jsonData)
if (error == nil && jsonData)
{
payload = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
} else {
NSLog(@"JSON stringify error: %@", error);
payload = @"";
return rejecter(error);
}
} else {
NSLog(@"theParams is empty.");
Expand Down
2 changes: 1 addition & 1 deletion Streamlyne-iOS-SDKTests/Streamlyne_iOS_SDKTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ - (void) testPushAssetWithRelationships
SLAsset *a1 = (SLAsset *)[[SLStore sharedStore] push:[SLAsset class] withData:pushData];
// NSLog(@"a1: %@", a1);
XCTAssertStringEqual(pushData[@"nid"], a1.nid, @"`nid`s should match.");
SLAttribute *attr = [SLAttribute initWithId:@"abc"];
SLAttribute *attr = [SLAttribute initWithId:@"abc" inContext:[SLStore sharedStore].context];
NSLog(@"Attr: %@", attr);
NSSet *attrs = a1.attributes;
NSLog(@"Attrs: %@", attrs);
Expand Down

0 comments on commit 61a9423

Please sign in to comment.