Changing a managed object property doesn’t trigger NSFetchedResultsController to update the table view

OK, I will explain your problem, then I will let you judge whether it is a bug in FRC or not. If you think it is a bug, then you really should file a bug report with apple. Your fetch result controller predicate is like this: NSString *predicate = [NSString stringWithFormat: @”clockSet.isOpen == YES”]; which … Read more

Reading and writing images to an SQLite DB for iPhone use

You’ll need to convert the UIImage hosted within your UIImageView into a binary BLOB for storage in SQLite. To do that, you can use the following: NSData *dataForImage = UIImagePNGRepresentation(cachedImage); sqlite3_bind_blob(yourSavingSQLStatement, 2, [dataForImage bytes], [dataForImage length], SQLITE_TRANSIENT); This will generate a PNG representation of your image, store it in an NSData instance, and then bind … Read more

Why should I call self=[super init]

You mean why self = [super init]; rather than [super init]; Two reasons: in initialisation, failure is indicated by returning nil. You need to know if initialisation of the super object failed. the super class might choose to replace the self returned by +alloc with a different object. This is rare but happens most frequently … Read more

How to use performSelector:withObject:afterDelay: with primitive types in Cocoa?

Here is what I used to call something I couldn’t change using NSInvocation: SEL theSelector = NSSelectorFromString(@”setOrientation:animated:”); NSInvocation *anInvocation = [NSInvocation invocationWithMethodSignature: [MPMoviePlayerController instanceMethodSignatureForSelector:theSelector]]; [anInvocation setSelector:theSelector]; [anInvocation setTarget:theMovie]; UIInterfaceOrientation val = UIInterfaceOrientationPortrait; BOOL anim = NO; [anInvocation setArgument:&val atIndex:2]; [anInvocation setArgument:&anim atIndex:3]; [anInvocation performSelector:@selector(invoke) withObject:nil afterDelay:1];

Should I refer to self.property in the init method with ARC?

Use direct access in partially constructed states, regardless of ARC: – (id)initWithReminder:(Reminder*)reminder_ { self = [super init]; if (self) { reminder = reminder_; // OR reminder = [reminder_ retain]; } return self; } This is because self.whatever will trigger other side effects, such as Key-Value Observing (KVO) notifications, or maybe your class implements (explicitly) or … Read more

Is there a way to suppress warnings in Xcode?

To disable warnings on a per-file basis, using Xcode 3 and llvm-gcc-4.2 you can use: #pragma GCC diagnostic ignored “-Wwarning-flag” Where warning name is some gcc warning flag. This overrides any warning flags on the command line. It doesn’t work with all warnings though. Add -fdiagnostics-show-option to your CFLAGS and you can see which flag … Read more