Post Tagged with: "ios"

Fix the iOS 6 text shortcuts bug

Fix the iOS 6 text shortcuts bug

 
14 Kudos
Don't
move!

After upgrading to iOS 6 I noticed that text shortcuts weren’t working as before.
Actually, the entire text prediction and spellchecker were working in a different manner. While for this latter there’s no turning back, I managed to find a solution for the first issue.

In order to get the text shortcuts back you need to hard-reboot your phone. In order to do so, press the Home button and while keeping it pressed, press the stand-by/wake up button. There are only two buttons on the iPhone (if we ignore the volume buttons) so it’s pretty easy. First the Home button, then the Wake up. You won’t
lose anything. It’s pretty much like resetting the PRAM of a Macbook. No data is in harm.

Wait a couple of seconds, the screen becomes black. Just release the buttons and turn the phone back on. This worked for me.

Other solutions I found on the web were about disabling and re-enabling the spellchecker, removing and re-adding one (or all) shortcuts but I didn’t test them since the hard-reboot worked for me.

If you have other suggestions, feel free to comment.

Edit: after a couple of days it seems that the text shortcuts feature is degrading as long as time passes by. Hopefully Apple will fix this upstream in the next firmware upgrade.
In the meanwhile you can always re-perform the hard-reboot as a dirty workaround.

October 1, 2012 0 comments Read More
Automatically update store schema with Core Data

Automatically update store schema with Core Data

 
10 Kudos
Don't
move!

Today I was playing with Core Data technology and I was trying to check whether it is possible to update the store schema according to the changes I made to the entities, relationships and whatever else.

I found out that the important steps are:

  • Use the versioning: before modifying your current schema you should select “Editor -> Add Model Version..”
  • Edit as much as you like
  • Select the new version as the active one
  • Go to your app delegate file and modify the - (NSPersistentStoreCoordinator *) persistentStoreCoordinator method as follows:
    NSURL *url = [applicationFilesDirectory URLByAppendingPathComponent:@"YourApp.storedata"];
        __persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:mom];
    
    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:  
    						 [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,  
    						 [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
    
    if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:options error:&error]) {
    		// The rest of the code here
    	}
    
    return __persistentStoreCoordinator;
    

    The highlighted lines are the one to be added. Please notice that row 8 needs to be updated with options:options. I only tried it using NSSQLiteStoreType as persistent store type but it should work fine even with NSXMLStoreType.

References:

  1. Working with Core Data: Schema Versioning and Lightweight Migrations
August 17, 2011 3 comments Read More