2011年8月17日水曜日

CoreDataの属性を変更したらエラーが起きる(Cocoa error 134100)

CoreDataの属性を変更したあとにアプリを起動させると以下のようなエラーが発生する場合がある。

Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)"
...
reason = "The model used to open the store is incompatible with the one used to create the store";

既にSQLiteのファイルが存在する場合はxcdatamodelが一致せずエラーが起きる。
addPersistentStoreWithTypeなどで指定したURLにあるSQLiteのデータファイルを削除する。

大抵の場合はこの場所にある。
/Users/%ユーザ名%/Library/Application Support/iPhone Simulator/%iOSのバージョン%/Applications/XXXXXXXX-XXXX-XX.../%SQLiteのファイル名%.sqlite

0 件のコメント:

コメントを投稿