Skip to content

Instantly share code, notes, and snippets.

@matzew
Created June 7, 2013 06:34
Show Gist options
  • Save matzew/80ef7d756c15ca774907 to your computer and use it in GitHub Desktop.
Save matzew/80ef7d756c15ca774907 to your computer and use it in GitHub Desktop.
Delegate with PList Store:
#import "AGViewController.h"
#import "AGAppDelegate.h"
#import "AeroGear.h"
@implementation AGAppDelegate {
AGDataManager* dm;
id<AGStore> myStore;
}
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// create the datamanager
dm = [AGDataManager manager];
// add a new (default) store object:
myStore = [dm store:^(id<AGStoreConfig> config) {
[config setName:@"tasks"];
[config setType:@"PLIST"];
}];
NSLog(@"didFinishLaunch: %@", [myStore readAll]);
return YES;
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
NSLog(@"applicationDidBecomeActive: %@", [myStore readAll]);
[myStore save:@{@"test": @"test", @"id": @"1"} error:nil];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment