Block properties
@property (nonatomic, copy) void (^myBlock)(void);
@property (nonatomic, copy) void (^myBlock)(NSString *parameter);
Block variables
void (^myBlock)() = ^()
{
NSLog(@"Do something");
};
void (^myBlock)(NSString *) = ^(NSString *parameter)
{
NSLog(@"Do something with %@", parameter);
};
Weak / Strong self references
__weak __typeof__(self) weakSelf = self;
__typeof__(self) strongSelf = weakSelf;
DLog
#ifdef DEBUG
#define DLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) {NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__]);[[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__];}
#else
#define DLog(...) do { } while (0)
#define ALog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
#endif
Symbolic breakpoints
-[NSObject(NSObject) doesNotRecognizeSelector:]
Kill Preferences daemon (OS X dev)
ps auwx | grep cfprefsd | grep -v grep | awk '{print $2}' | xargs sudo kill -9