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
///--------------------------------------------------------------------------------------- | |
/// @name Creating Users | |
///--------------------------------------------------------------------------------------- | |
+ (KCSUser *)userWithUsername: (NSString *)username password: (NSString *)password; | |
+ (void)checkForExistingUsernameWithBlock: (KCSUsernameCheckBlock)checkBlock; |
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
// If you have a userController that manages a view for logging-in/creating users | |
- (IBAction)loginUser:(id)sender | |
{ | |
// Log in the user and notify this class that logging-in completed | |
[KCSUser loginWithUsername:self.username.text password:self.username.password withDelegate:self]; | |
} | |
- (IBAction)createUser:(id)sender | |
{ |
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
// This code assumes that you have a class with a description property, | |
// an address property and a coordinates property. To properly enable | |
// geo queries, makes sure to map the "description" property to _geoloc | |
// in your mapping function (eg, @"_geoloc", @"description" in the dictionary | |
// initializer). | |
myPlace1.description = @"2000 sq feed small company office"; | |
myPlace1.address = @"1 Main St, Cambridge, MA"; | |
myPlace1.coordinates = [NSArray arrayWithObjects: | |
[NSNumber numberWithDouble:-71.083934], |
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
GET /appdata/[appKey]/stories/?query={"name":"Dewey Defeats Truman"} | |
[{"_id": "deweyDefeatsTruman", | |
"name": "Dewey Defeats Truman", | |
"reporter": "Arthur Sears Henning"}] | |
GET /appdata/[appKey]/comments/?query={"storyId":"deweyDefeatsTruman"} | |
[{"_id": "001", | |
"storyId": "deweyDefeatsTruman", |
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
// Find all Dr's named Joe at Mercy Hospital | |
GET /appdata/[appKey]/doctors/?query={"firstName": "Joe", "hospital": "Mercy"} | |
[{"_id": "998798ad987fe987e987bc98766", | |
"firstName": "Joe", | |
"lastName": "Brown", | |
"hospital": "Mercy", | |
"speciality": "oncology"}, | |
{"_id": "ca6775feba86554", |
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
// Defined somewhere in your headers | |
// Class for representing Stories | |
@interface Story : NSObject <KCSPersistable> | |
NSString *storyId; // In your mapping function this should map to "_id" | |
NSString *name; | |
NSString *reporter; | |
@end | |
// Class for representing comments |
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": "theArtist", | |
"title": "The Artist", | |
"year": 2011, | |
"director": "Michel Hazanavicius", | |
"awards": [{"event": "Academy Awards", | |
"awards": [{"name": "Best Picture", "notes": ""}, | |
{"name": "Best Director", "notes": "Hazanavicius"}, | |
{"name": "Best Actor", "notes": "Dujardin"}, | |
{"name": "Best Costume Design", "notes": ""}, | |
{"name": "Best Original Score", "notes": ""}]}, |
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
// Called to update fetch all annotations | |
- (void)updateMarkers | |
{ | |
// Get the current limits of the map view | |
MKCoordinateSpan span = self.worldView.region.span; | |
// KINVEY: Geo Queries use miles and there are ~69 miles per each latitudeDelta | |
double distanceInMiles = span.latitudeDelta*69; | |
CLLocationCoordinate2D mapCenter = self.worldView.centerCoordinate; |
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
// KINVEY: Save this note to Kinvey | |
[note saveToCollection:self.mapNotes withDelegate:self]; |
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
#pragma mark - | |
#pragma mark KCSPersistableDelegate | |
// Kinvey: Called when a save is complete | |
-(void)entity:(id)entity operationDidCompleteWithResult:(NSObject *)result | |
{ | |
// Everything worked, so stop animating the activity indicator | |
[self.activityIndicator stopAnimating]; | |
} |
OlderNewer