2011-07-27 10 views
3

を作成することはできません、私は次のエラーを取得しています:が永続ストアコーディネータ

*** Terminating app due to uncaught exception 'NSInternalInconsistencyExprojectception', reason: 'Managed object store failed to create persistent store coordinator: Error Domain=NSCocoaErrorDomain Code=134130 "The operation couldn’t be completed. (Cocoa error 134130.)" UserInfo=0x6eb53f0 {URL=/Users/user/Library/Application Support/iPhone Simulator/4.3.2/Applications/4EFD7570-AD87-48E8-8606-1D5633F65AD9/Documents/DiscussionBoard.sqlite, metadata=<CFBasicHash 0x6e7b610 [0x1957400]>{type = immutable dict, count = 7, 
entries => 
    2 : <CFString 0x6e7bc80 [0x1957400]>{contents = "NSStoreModelVersionIdentifiers"} = <CFArray 0x6e7bd60 [0x1957400]>{type = immutable, count = 1, values = (
    0 : <CFString 0x194eed0 [0x1957400]>{contents = ""} 
)} 
    4 : <CFString 0x6e7bcb0 [0x1957400]>{contents = "NSPersistenceFrameworkVersion"} = <CFNumber 0x6e7b820 [0x1957400]>{value = +320, type = kCFNumberSInt64Type} 
    6 : <CFString 0x6e7bce0 [0x1957400]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x6e7c310 [0x1957400]>{type = immutable dict, count = 13, 
entries => 
    0 : <CFString 0x6e7bd80 [0x1957400]>{contents = "CVImage"} = <CFData 0x6e7bf00 [0x1957400]>{length = 32, capacity = 32, bytes = 0xbd556295681226e6b1fd6142e2e7bfcc ... e38b423dd3965969} 
    2 : <CFString 0x6e7bda0 [0x1957400]>{contents = "CVMembers"} = <CFData 0x6e7bf50 [0x1957400]>{length = 32, capacity = 32, bytes = 0xa3d504782e9111ed01b1c02575c48119 ... 1bd1d59e42507652} 
    4 : <CFString 0x6e7bdc0 [0x1957400]>{contents = "CVMessages"} = <CFData 0x6e7bfa0 [0x1957400]>{length = 32, capacity = 32, bytes = 0xfbd5da9b0fc0ea188505807aea912e83 ... e3a42fa8fbdf416c} 
    8 : <CFString 0x6e7bde0 [0x1957400]>{contents = "CVEmbed"} = <CFData 0x6e7bff0 [0x1957400]>{length = 32, capacity = 32, bytes = 0x5d65d864e7881875c52882a8fd709079 ... e3ad8204d4ca3de3} 
    9 : <CFString 0x6e7be00 [0x1957400]>{contents = "CVGroup"} = <CFData 0x6e7c040 [0x1957400]>{length = 32, capacity = 32, bytes = 0xb2989b51004a22a8fb78971436462bcc ... 39d14fd18d892843} 
    10 : <CFString 0x6e7be20 [0x1957400]>{contents = "CVImgur"} = <CFData 0x6e7c090 [0x1957400]>{length = 32, capacity = 32, bytes = 0x57cb45112309b9fce595cbee14c87e98 ... f88cd7d4eadeb9aa} 
    12 : <CFString 0x6e7be40 [0x1957400]>{contents = "CVLinks"} = <CFData 0x6e7c0e0 [0x1957400]>{length = 32, capacity = 32, bytes = 0x715c27157179226a0a44cd0015b9017d ... 26a06c18c21630d3} 
    13 : <CFString 0x6e7b7c0 [0x1957400]>{contents = "CVStar"} = <CFData 0x6e7c130 [0x1957400]>{length = 32, capacity = 32, bytes = 0xeaba2443e38c48975f8e1eda97788ce3 ... 6939185adf9f8bc4} 
    14 : <CFString 0x6e7be60 [0x1957400]>{contents = "CVLogin"} = <CFData 0x6e7c180 [0x1957400]>{length = 32, capacity = 32, bytes = 0x3089c83eba00f29b13543cdfa16514d7 ... db609adb46524cab} 
    16 : <CFString 0x6e7be80 [0x1957400]>{contents = "CVTopics"} = <CFData 0x6e7c1d0 [0x1957400]>{length = 32, capacity = 32, bytes = 0x6ba8c6c71281ae9f3731a180cb0509cb ... 3aedf32173e19adf} 
    17 : <CFString 0x6e7bea0 [0x1957400]>{contents = "CVConversation"} = <CFData 0x6e7c220 [0x1957400]>{length = 32, capacity = 32, bytes = 0xac552b4d9d0a2c0425facda397d0f3c1 ... 8a7b7d36c9a14af3} 
    20 : <CFString 0x6e7bec0 [0x1957400]>{contents = "CVMessage"} = <CFData 0x6e7c270 [0x1957400]>{length = 32, capacity = 32, bytes = 0x80e0118b52f9679904a359ce469b116a ... ad08d1f238e71130} 
    21 : <CFString 0x6e7bee0 [0x1957400]>{contents = "CVTopic"} = <CFData 0x6e7c2c0 [0x1957400]>{length = 32, capacity = 32, bytes = 0xe1898a56a02e523bc8879e812cecd756 ... 339f8023561d35f9} 
} 

    7 : <CFString 0x7888b0 [0x1957400]>{contents = "NSStoreUUID"} = <CFString 0x6e7b970 [0x1957400]>{contents = "BDA8B03E-81DA-472C-8966-936DC080900F"} 
    8 : <CFString 0x788720 [0x1957400]>{contents = "NSStoreType"} = <CFString 0x7888f0 [0x1957400]>{contents = "SQLite"} 
    9 : <CFString 0x6e7bd10 [0x1957400]>{contents = "NSStoreModelVersionHashesVersion"} = <CFNumber 0x5f70a40 [0x1957400]>{value = +3, type = kCFNumberSInt32Type} 
    10 : <CFString 0x6e7bd40 [0x1957400]>{contents = "_NSAutoVacuumLevel"} = <CFString 0x6e7c410 [0x1957400]>{contents = "2"} 
} 
, reason=Can't find model for source store}' 

これは、ソースストアのモデルを見つけることができないと言いますか?これは何を意味するのでしょうか?

コードは次のとおりです。

- (void)createPersistentStoreCoordinator { 
    NSURL *storeUrl = [NSURL fileURLWithPath:self.pathToStoreFile]; 

    NSError *error; 
    _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:_managedObjectModel]; 

    // Allow inferred migration from the original version of the application. 
    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: 
          [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, 
          [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; 

    if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]) { 
     if (self.delegate != nil && [self.delegate respondsToSelector:@selector(managedObjectStore:didFailToCreatePersistentStoreCoordinatorWithError:)]) { 
      [self.delegate managedObjectStore:self didFailToCreatePersistentStoreCoordinatorWithError:error]; 
     } else { 
      NSAssert(NO, @"Managed object store failed to create persistent store coordinator: %@", error); //fails right here 
     } 
    } 
} 
+1

この例外を発生させるコードも投稿する必要があります。 – tidwall

+0

申し訳ありませんが、上記のコードを投稿しました.. NSAssertで失敗します – adit

+0

Googleでこのエラーフレーズを検索しようとしましたか?もしそうなら、あなたは何を試しましたか? –

答えて

2

物事あなたは確認する必要があります:

  • をあなたは正しくあなたのコンテキストをロードしている、と.momdファイルはアプリのバンドルに追加されていることを確認し
  • あなたのエンティティはデータモデルに「店舗」という名前になっていることを確認しCoreDataを扱うときにビジュアルエディタ

はまた、多くの有用な情報を保持している面白いのuserinfoがあります:

NSDictionary *ui = [error userInfo]; 
     for(NSString *err in [ui keyEnumerator]) { 
      NSLog(@"err:%@",[ui objectForKey:err]); 
     } 
0

NSAssert文が真であるか否かの主張を行っています。それにNOを渡すことで、アサーションチェックが必ず失敗するようにしています。前のif文がfalseの場合、強制的に強制的に失敗させることを前提としています。

+0

はい、これはどうして解決できますか?つまり、基本的にデリゲートがnilであるか、指定したセレクタに応答しないということですか? – adit

+0

私は確信していません - 私は過去にこのエラーがありませんでした。これはあなたがここに投稿しているコードですか?それとも、別のソース(ライブラリなど)から書いたり、取り込んだコードですか? – aperkins

+0

それは私が別のフレームワークから取ったものです – adit

15

あなたはRestKitを使用していることに気付きました。以前はこの問題があり、SqlLiteデータベースを削除して解決しました。私にとっては、新しい関係を追加したときだったし、データベースは新しい属性が気に入らなかった。

注:これは開発には問題ありませんが、通常はコアデータの移行を実行する必要があります(アプリケーションによっては、データが失われることはありません)。

7

はい、私はfiretoastに同意します。デバイス/エミュレータからアプリケーションを削除して再インストールするだけで問題は消えてしまいます。これは通常、私のコアデータスキーマを編集し、Restkitを使用して永続化した後に起こります。

+0

これはまた私のために働いた。 – Undistraction