Closed BlixLT closed 6 years ago
You should already be able to do
QSDefaultCoreDataAdapterDelegate *delegate = [QSDefaultCoreDataAdapterDelegate sharedInstance];
QSCoreDataStack *stack = [[QSCoreDataStack alloc] initWithStoreType:NSSQLiteStoreType model:[QSCoreDataAdapter persistenceModel] storePath:[self storePathWithAppGroup:suiteName]];
// Notice this line
QSCoreDataAdapter *adapter = [[QSCoreDataAdapter alloc] initWithPersistenceStack:stack targetContext:context recordZoneID:*Your own record zone ID* delegate:delegate];
NSUserDefaults *suiteUserDefaults = [NSUserDefaults standardUserDefaults];
CKContainer *container = [CKContainer containerWithIdentifier:containerName];
QSCloudKitSynchronizer *synchronizer = [[QSCloudKitSynchronizer alloc] initWithIdentifier:@"DefaultCoreDataPrivateSynchronizer" containerIdentifier:containerName database:container.privateCloudDatabase adapterProvider:nil keyValueStore:suiteUserDefaults];
[synchronizer addModelAdapter:adapter];
But I agree that it would be nice to have a factory method to simplify this 👍
Added extra methods to make this easier in 0.6.7
Would it be possible to support custom zone names? Right now synchronizer creates default QS... zone and I don't see a way to customise it. Or is there any that I miss? My suggestion would be an initialiser with one more parameter:
+ (QSCloudKitSynchronizer *)cloudKitPrivateSynchronizerWithContainerName:(NSString *)containerName managedObjectContext:(NSManagedObjectContext *)context suiteName:(NSString *)suiteName recordZoneID:(CKRecordZoneID *)recordZoneID;