Skip to content

Instantly share code, notes, and snippets.

@drapp
Created May 2, 2012 21:16
Show Gist options
  • Save drapp/2580591 to your computer and use it in GitHub Desktop.
Save drapp/2580591 to your computer and use it in GitHub Desktop.
iOS New SDK Feature May 2012
[[StackMob stackmob] count:@"user" withCallback:^(BOOL success, id result) {
if (success) {
// object found, cast result to NSNumber* and continue with processing
} else {
// unable to retrieve object, cast result to NSError* and inspect code & message
}
}];
StackMobQuery *q = [StackMobQuery query];
[q field:@"age" mustbeLessThanValue:[NSNumber numberWithInt:35]];
[q field:@"follower_count" mustBeGreaterThanOrEqualToValue:[NSNumber numberWithInt:20]];
// perform the query and handle the results
[[StackMob stackmob] count:@"user" withQuery:q andCallback:^(BOOL success, id result) {
if (success) {
// object found, cast result to NSNumber* and continue with processing
} else {
// unable to retrieve object, cast result to NSError* and inspect code & message
}
}];
BOOL loggedIn = [[StackMob stackmob] isLoggedIn];
BOOL loggedOut = [[StackMob stackmob] isLoggedOut];
NSString *name = [[StackMob stackmob] loggedInUser];
BOOL loggedIn = [[StackMob stackmob] isUserLoggedIn:@"name"];
StackMobQuery *q = [StackMobQuery query];
[q field:@"account_status" mustNotEqualValue:@"closed"];
[q fieldMustBeNull:@"account"];
[q fieldMustNotBeNull:@"email"];
// perform the query and handle the results
[[StackMob stackmob] get:@"user" withQuery:q andCallback:^(BOOL success, id result) {
if (success) {
// cast result to NSArray and process results
} else {
// cast result to NSError and handle query error
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment