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
- (instancetype) initWithDictionary:(NSDictionary *)dictionary { | |
self = [super initWithDictionary:dictionary]; | |
if (self) { | |
_postTitle = dictionary[@"postTitle"]; | |
_postBody = dictionary[@"postBody"]; | |
} |
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
- (NSString *)collectionName { | |
return @"document/memos"; | |
} |
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
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
BAAClient *client = [BAAClient sharedClient]; | |
if (client.isAuthenticated) { | |
NSLog(@"Logged in"); | |
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
BAAClient *client = [BAAClient sharedClient]; | |
client.isAuthenticated |
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
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
BAAClient *client = [BAAClient sharedClient]; | |
if (client.isAuthenticated) { | |
NSLog(@"Logged in"); | |
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
- (IBAction) login { | |
NSLog(@"login"); | |
BAAClient *client = [BAAClient sharedClient]; | |
[client authenticateUser:self.loginUsernameField.text | |
password:self.loginPasswordField.text | |
completion:^(BOOL success, NSError *error) { | |
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
- (void)createNewPost:(id)sender { | |
if (!_posts) { | |
_posts = [[NSMutableArray alloc] init]; | |
} | |
SMPost *p = [[SMPost alloc] init]; | |
p.postTitle = [NSString stringWithFormat:@"No title %i", _posts.count ]; | |
p.postBody = @"No body"; | |
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
- (void) savePost:(id)sender { | |
self.post.postTitle = self.titleField.text; | |
self.post.postBody = self.bodyTextView.text; | |
[self.post saveObjectWithCompletion:^(id object, NSError *error) { | |
if (error == nil) { | |
NSLog(@"object saved"); |
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
@interface SMPost : BAAObject | |
@property (copy) NSString *postTitle; | |
@property (copy) NSString *postBody; | |
@end |
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
- (instancetype) initWithDictionary:(NSDictionary *)dictionary { | |
self = [super initWithDictionary:dictionary]; | |
if (self) { | |
_postTitle = dictionary[@"postTitle"]; | |
_postBody = dictionary[@"postBody"]; | |
} |