How to insert special characters on Mac
Jay Versluis
How to delete an NSManagedObject in Core Data
You can delete individual objects by using the NSManagedObjectContext method deleteObject, like so: [self.managedObjectContext deleteObject:yourManagedObject]; To delete all managed objects from your store, you can use a for-in loop: – (void)clearCoreData { NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@”YourEntity” inManagedObjectContext:self.managedObjectContext]; [fetchRequest setEntity:entity]; NSError *error = nil; NSArray *fetchedObjects = [self.managedObjectContext executeFetchRequest:fetchRequest […]
How to tweak SQLIte Performance in Core Data…
How to tweak SQLIte Performance in Core Data – thanks to @artandlogic
How to show SQLite Debug output from Core Data in iOS
Add this statement to your app’s Run Scheme -com.apple.CoreData.SQLDebug 1 and your Log Console shall be populated with fascinating statements such as 2013-11-20 18:49:53.715 YourApp[6245:70b] CoreData: annotation: Connecting to sqlite database file at “/Users/versluis/Library/Application Support/iPhone Simulator/7.1-64/Applications/1FED9364-3039-4D47-967E-9B075CBE8277/Documents/PatchBay.sqlstore” 2013-11-20 18:49:53.717 YourApp[6245:70b] CoreData: sql: pragma journal_mode=wal 2013-11-20 18:49:53.718 YourApp[6245:70b] CoreData: sql: pragma cache_size=200 2013-11-20 18:49:53.719 YourApp[6245:70b] CoreData: sql: […]
How to add command line arguments in Xcode 5
Same as in Xcode 4 – find the following commands from the Main Menu: Product Scheme – Edit Scheme find Run in the left hand column click the Arguments tab
How to check if your app is running in 64bit
There are two ways to determine this: at runtime (i.e. in your running code), and at compile time (i.e. before the code is compiled). Let’s take a look at both options. Runtime Check // testing for 64bit at runtime if (sizeof(void*) == 4) { self.textLabel.text = @”You’re running in 32 bit”; } else if (sizeof(void*) […]
How to create an NSDate object from a string such as 22/04/2013
Here’s how we can do this, with the help of our old friend the NSDateFormatter: // here we have a date NSString *dateString = @”11/01/1989″; // convert it into an NSDate object NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; [formatter setDateFormat:@”dd/MM/yyyy”]; NSDate *theDate = [formatter dateFromString:dateString]; // so what is that? NSLog(@”Your Date Object is %@”, theDate); […]
How to return the section title in a UITableView with Core Data
Our NSFetchedResultsController can take care of this too:
– (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if ([[self.fetchedResultsController sections] count] > 0) {
id <NSFetchedRes…