我正在努力让FTASync适用于我的iPad应用。这是FTASync代码,它给我一个构建错误,我不知道它有什么问题。我不得不替换一个已弃用的声明:
[MagicalRecord saveInBackgroundWithBlock:^(localContext)
使用以下内容(第一个语句;其余部分是原始FTASync代码)
[localContext MR_saveToPersistentStoreWithCompletion:^(BOOL success, NSError *error){
[self syncAll];
}
completion:^{
if (self.progressBlock)
self.progressBlock(1.0, @"Complete");
if (![NSThread isMainThread]) {
FSALog(@"%@", @"Completion block must be called on main thread");
}
//Use this notification and user defaults key to update an "Last Updated" message in the UI
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"FTASyncLastSyncDate"];
[[NSUserDefaults standardUserDefaults] synchronize];
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:@"FTASyncDidSync" object:nil];
});
if (completion)
completion();
self.syncInProgress = NO;
self.progressBlock = nil;
self.progress = 0;
//End background task
if ([[UIDevice currentDevice] isMultitaskingSupported]) {
FSCLog(@"Completed sync.");
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}
}];
这是完成的定义:
typedef void(^ FTACompletionBlock)(void);
这是我得到的构建错误,这可能是由某处的语法错误引起的,但我没有看到它:
'NSManagedObjectContext'没有可见的@interface声明选择器'MR_saveToPersistentStoreWithCompletion:completion:'
有人能告诉我是什么原因引起的吗?以及如何解决它?