Cache Errors While Executing OData Online Requests

Problem

.Cache errors while executing OData online requests.

Fix

For the cache initialization error "Initialize Error: Error Domain=CacheOperationError Code=1000 "Cannot create an NSPersistentStoreCoordinator with a nil model", ensure that the cache.bundle is imported into the project correctly.

For the cache initialization error Initialize Error : Error Domain=PersistenceError Code=999 "The operation couldn’t be completed. (PersistenceError error 999.), manage the encryption key:
  1. Fetch the encryption key using the following code, the first time you start the application:
    NSString *key = [EncryptionKeyManager getEncryptionKey:&error];

    Ensure you save the key securely, either using UserDefaults or DataVault.

  2. Set the encryption on every restart of your application using the following code:
    [EncryptionKeyManager setEncryptionKey:[defaults objectForKey:@"encryptionKey"] withError:&error];

For these cache errors that occur while executing an OData online request: Error Domain=Persistence Error Code=700 "The operation couldn’t be completed. (Persistence Error error 700.)" and Error storing the cookies in Cache, no action is required. These errors can be ignored.