blackberry.com
BlackBerry Dynamics
Runtime library for macOS applications
from the application developer portal

GDPersistentStoreCoordinator Class Reference

NSPersistentStoreCoordinator subclass that supports an encrypted binary store type in Core Data. More...

#import <GDPersistentStoreCoordinator.h>


Detailed Description

BlackBerry Dynamics applications can store Core Data objects in the secure store.

Using this class instead of the default NSPersistentStoreCoordinator allows the use of the following additional Core Data store types.

GDEncryptedBinaryStoreType
Encrypted binary store that is stored in the BlackBerry Dynamics secure store.
Use this in place of NSBinaryStoreType.
GDEncryptedIncrementalStoreType
Encrypted incremental store that is stored in the BlackBerry Dynamics secure store.
Use this in place of NSSQLiteStoreType.
Note the following.

  • When these store types are in use, the URL parameter will be an absolute path within the BlackBerry Dynamics secure file system.
  • Use of this class with store types other than the above results in identical behavior to using the default class. The above additional store types cannot be used with the default class.
  • Data can be migrated from an NSSQLiteStoreType store to a GDEncryptedIncrementalStoreType store. Use the Core Data migration API to do this.
    For an example, see the CoreData sample application supplied with the BlackBerry Dynamics Software Development Kit for iOS.
    It isn't possible to import an NSSQLiteStoreType store file directly into the secure file system, and then use it as a GDEncryptedIncrementalStoreType store.
  • Core Data stores of the above types cannot be accessed until BlackBerry Dynamics authorization processing has completed. This means that construction of the Managed Object Context, and the population of views, must be deferred until after authorization.
    For an example of deferred construction and population, see the CoreData sample application supplied with the BlackBerry Dynamics Software Development Kit for iOS.
See also:
Core Data Programming Guide on the apple.com developer website.
GDFileManager
Secure SQL Database API
GDMac, for BlackBerry Dynamics authorization.

Code Snippets

The following code snippets illustrate some common tasks.

Utilize BlackBerry Dynamics Persistent Store Coordinator

 - (NSPersistentStoreCoordinator *)persistentStoreCoordinator
 {
      if (__persistentStoreCoordinator != nil) {
          return __persistentStoreCoordinator;
      }

      // The URL will be a path in the secure container
      NSURL *storeURL = [NSURL URLWithString:@"/example.bin"];

      NSError *error = nil;
      __persistentStoreCoordinator =
          [[GDPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
      if (![__persistentStoreCoordinator
              addPersistentStoreWithType: GDEncryptedBinaryStoreType
                           configuration: nil
                                     URL: storeURL
                                 options: nil
                                   error: &error]
      ) {
          abort();
      }

      return __persistentStoreCoordinator;
 }

The documentation for this class was generated from the following file: