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)awakeFromInsert | |
{ | |
[super awakeFromInsert]; | |
Partner *partner = [NSEntityDescription | |
insertNewObjectForEntityForName:@"Partner" | |
inManagedObjectContext:[self managedObjectContext]]; | |
[self setPartner:partner]; | |
} |
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)addWithCompletionHandler:(void (^)(id object))completionHandler; | |
{ | |
[self commitEditingWithDelegate:self | |
didCommitSelector:@selector(controller:didCommit:contextInfo:) | |
contextInfo:[completionHandler copy]]; | |
} | |
- (void)controller:(NSArrayController *)editor didCommit:(BOOL)didCommit contextInfo:(void *)contextInfo; | |
{ | |
void (^completionHandler)(id object) = contextInfo; |
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 *string = @"test"; | |
BOOL result = [string isEqualToString:nil]; |
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
NSNumber *number = [NSNumber numberWithInt:0]; | |
BOOL result = [number isEqualToNumber:nil]; |
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 *string = nil; | |
BOOL result = [string isEqualToString:@""]; | |
NSNumber *number = nil; | |
BOOL result = [number isEqualToNumber:[NSNumber numberWithInt:0]]; |
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
[[textField cell] setBackgroundStyle:NSBackgroundStyleRaised]; |
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
// compiled with ARC enabled | |
NSArray *foo() { | |
NSMutableArray *res = [NSMutableArray array]; | |
for (int i = 0; i < 3; i++) { | |
[res addObject:^{ | |
NSLog(@"%d", i); | |
}]; | |
} | |
return res; |
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 freeKeychainContent(void *ptr, void *info) | |
{ | |
SecKeychainItemFreeContent(NULL, ptr); | |
} | |
- (NSString *)passwordFromKeychainItem:(SecKeychainItemRef)keychainItem | |
{ | |
void *passwordData; | |
UInt32 passwordLength; | |
OSStatus status = SecKeychainItemCopyContent(keychainItem, |
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
/* | |
NSManagedObjectContextShim.h | |
NSManagedObjectContextShim | |
Created by Daniel Tull on 25.07.2012. | |
Copyright (c) 2012 Daniel Tull. All rights reserved. | |
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
// Begin the power assertion | |
IOPMAssertionID assertionID; | |
IOReturn asserted = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, | |
kIOPMAssertionLevelOn, | |
CFSTR("Sandvox Publishing"), | |
&assertionID); | |
if (asserted != kIOReturnSuccess) // handle the error; log it or something | |
// Do your long-running work |