title: Why core data won't trigger my value transformer?
body: <p>I'm try to store CCLocation in CoreData.
  I'm on beginning of write my custom value transformer, but i'm stuck.</p>
  
  <p><strong>My transformer:</strong> </p>
  
  <pre><code>#import "LocationToDataTransformer.h"
  #import &lt;CoreLocation/CoreLocation.h&gt;
  @implementation LocationToDataTransformer
  + (BOOL)allowsReverseTransformation {
      return YES;
  }
  
  + (Class)transformedValueClass {
       NSLog(@"tranform");
      return [NSData class];
  
  }
  
  - (id)transformedValue:(id)value {
      NSData *data = [NSKeyedArchiver archivedDataWithRootObject:value];
      NSLog(@"tranform");
      return data;
  }
  
  - (id)reverseTransformedValue:(id)value {
       CLLocation *location = (CLLocation*)[NSKeyedUnarchiver unarchiveObjectWithData:value];
       NSLog(@"tranform");
      return location;
  }
  
  @end
  </code></pre>
  
  <p><strong>And transformer registration:</strong></p>
  
  <pre><code>+ (void)initialize {
  
          LocationToDataTransformer *transformer = [[LocationToDataTransformer alloc] init];
           [NSValueTransformer setValueTransformer:transformer forName:@"LocationToDataTransformer"];
  
  }
  </code></pre>
  
  <p>I've check [NSValueTransformer valueTransformerNames] array and i see my transformer name in it.</p>
  
  <p>In model I have a entity with 3 attributes:</p>
  
  <ol>
  <li>title (string)</li>
  <li>subtitle (string)</li>
  <li>location (transformable) - value transformer
  name:LocationToDataTransformer</li>
  </ol>
  
  <p>And when I'm saving my location, nothing happens, other attributes of entity (strings) saves, but location is nil.</p>
  
  <p><strong>Saving entity code:</strong></p>
  
  <pre><code>-(void)saveBookmark:(BookmarkEntity*)bookmark {
      NSManagedObject *object = [[NSManagedObject alloc]initWithEntity:_descr insertIntoManagedObjectContext:_context];
      BookmarkEntity* entity = (BookmarkEntity*)object;
      entity.title = bookmark.title;
      entity.subtitle = bookmark.subtitle;
      entity.location = bookmark.location;
      if (_context.hasChanges) {
          NSError* error;
          bool saved = [_context save:&amp;error];
          if (!saved) {
              NSLog(@"Error while saving: %@",error.localizedDescription);
          }
      }
  }
  </code></pre>
  
  <p>As you can see i've added NSLog's to my transformer, but i not see it in logs. Also i try breakpoints, and no one method from my transformer don't calls.
  I even try to set transformer name to "abracadabra" and see nothing in logs, nothing about wrong value transformer name.
  I'm totally confused. Anyone have an idea where i missed up? Thanks.</p>