Permalink
Browse files

Array params have been removed

`performSelector:withObject:afterDelay` replaced to `dispatch_after` in
same time
  • Loading branch information...
1 parent b30bb2b commit 2e986ac152921562d5cd826ce1dc2a8298d71627 @ilin-in committed Feb 21, 2013
@@ -30,7 +30,7 @@ extern NSString * const kMagicalRecordPSCDidCompleteiCloudSetupNotification;
- (NSPersistentStore *) MR_addInMemoryStore;
- (NSPersistentStore *) MR_addAutoMigratingSqliteStoreNamed:(NSString *) storeFileName;
-- (NSPersistentStore *) MR_addAutoMigratingCustomStoreNamed:(NSArray *) params;
+- (NSPersistentStore *) MR_addAutoMigratingCustomStoreNamed:(NSString*)fileName storeType:(NSString*)storeTypeName;
- (NSPersistentStore *) MR_addSqliteStoreNamed:(id)storeFileName withOptions:(__autoreleasing NSDictionary *)options;
- (NSPersistentStore *) MR_addCustomStoreNamed:(id)storeFileName withOptions:(__autoreleasing NSDictionary *)options storeType:(NSString*)storeType;
@@ -147,18 +147,9 @@ - (NSPersistentStore *) MR_addAutoMigratingSqliteStoreNamed:(NSString *) storeFi
return [self MR_addSqliteStoreNamed:storeFileName withOptions:options];
}
-/**
- @params Array of parameters:
- - Store file name
- - Store type name
- */
-- (NSPersistentStore *) MR_addAutoMigratingCustomStoreNamed:(NSArray *) params;
-{
- if (params.count < 2) {
- MRLog(@"Error: Argument count mismatch on '%s'.", __FUNCTION__);
- }
+- (NSPersistentStore *) MR_addAutoMigratingCustomStoreNamed:(NSString*)fileName storeType:(NSString*)storeTypeName {
NSDictionary *options = [[self class] MR_autoMigrationOptions];
- return [self MR_addCustomStoreNamed:params[0] withOptions:options storeType:params[1]];
+ return [self MR_addCustomStoreNamed:fileName withOptions:options storeType:storeTypeName];
}
#pragma mark - Public Class Methods
@@ -188,12 +179,17 @@ + (NSPersistentStoreCoordinator *) MR_coordinatorWithAutoMigratingCustomStoreNam
storeType = NSSQLiteStoreType;
}
- [coordinator MR_addAutoMigratingCustomStoreNamed:@[storeFileName, storeType]];
+ [coordinator MR_addAutoMigratingCustomStoreNamed:storeFileName storeType:storeType];
//HACK: lame solution to fix automigration error "Migration failed after first pass"
- if ([[coordinator persistentStores] count] == 0)
+ if ([[coordinator persistentStores] count] == 0)
{
- [coordinator performSelector:@selector(MR_addAutoMigratingCustomStoreNamed:) withObject:@[storeFileName, storeType] afterDelay:0.5];
+ int64_t delay = 0.5;
+ dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC);
+ dispatch_after(time, dispatch_get_current_queue(), ^(void){
+ [coordinator performSelector:@selector(MR_addAutoMigratingSqliteStoreNamed:) withObject:storeFileName afterDelay:0.5];
+ [coordinator MR_addAutoMigratingCustomStoreNamed:storeFileName storeType:storeType];
+ });
}
return coordinator;

0 comments on commit 2e986ac

Please sign in to comment.