Restkit 0.20 ではこれを試してみてください。これは、RKTestFactory.mファイルのRestKit/Testingコンポーネントにあるコードに基づいており、私のプロジェクトではうまくいきました。
また、RestKitが自分のCoreDataスタックを管理している場合(これは私の設定方法です)、RestKitセットアップでNSManagedObjectContextを使用しているNSFetchedResultsControllerを削除してください。
- (void)tearDownRestKit
{
// Cancel any network operations and clear the cache
[[RKObjectManager sharedManager].operationQueue cancelAllOperations];
[[NSURLCache sharedURLCache] removeAllCachedResponses];
// Cancel any object mapping in the response mapping queue
[[RKObjectRequestOperation responseMappingQueue] cancelAllOperations];
// Ensure the existing defaultStore is shut down
[[NSNotificationCenter defaultCenter] removeObserver:[RKManagedObjectStore defaultStore]];
// Not be needed if not using indexer
if ([[RKManagedObjectStore defaultStore] respondsToSelector:@selector(stopIndexingPersistentStoreManagedObjectContext)]) {
// Search component is optional
[[RKManagedObjectStore defaultStore] performSelector:@selector(stopIndexingPersistentStoreManagedObjectContext)];
if ([[RKManagedObjectStore defaultStore] respondsToSelector:@selector(searchIndexer)]) {
id searchIndexer = [[RKManagedObjectStore defaultStore] valueForKey:@"searchIndexer"];
[searchIndexer performSelector:@selector(cancelAllIndexingOperations)];
}
}
[RKObjectManager setSharedManager:nil];
[RKManagedObjectStore setDefaultStore:nil];
}
RestKit 0.20以降では、[[RKManagedObjectStore defaultStore] resetPersistentStores:nil]; ' –
を使用する必要があります。RestKit 0.20を使用して私のために働きましたhttp://stackoverflow.com/a/18425303/1318202 –
こんにちは@ blake-wattersそれは0.20バージョンで行う –