Created
May 2, 2012 21:16
-
-
Save drapp/2580591 to your computer and use it in GitHub Desktop.
iOS New SDK Feature May 2012
This file contains 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
[[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 | |
} | |
}]; |
This file contains 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
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 | |
} | |
}]; |
This file contains 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
BOOL loggedIn = [[StackMob stackmob] isLoggedIn]; | |
BOOL loggedOut = [[StackMob stackmob] isLoggedOut]; | |
NSString *name = [[StackMob stackmob] loggedInUser]; | |
BOOL loggedIn = [[StackMob stackmob] isUserLoggedIn:@"name"]; |
This file contains 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
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