LoginSignup
1
1

More than 5 years have passed since last update.

GHTestなんかでユニットテストする時にCoreDataのmanagedObjectModelが初期化できなくて困ったら

Posted at

下記なんかを見ると幸せになれるかも。
http://blog.f60k.com/xcode4_coredata_logic_unittest/
http://stackoverflow.com/questions/5662947/unit-test-cant-find-core-data-model-file

      NSBundle* bundle = [NSBundle bundleWithIdentifier:@"xxx.aaa.yyy"];
      modelURL = [bundle URLForResource:@"MyResource" withExtension:@"momd"];
      Log(@"modelURL : %@",modelURL);

xxx.aaa.yyyの名前はGHTest-Info.plistなんかにBundle identifierとして書かれているものを持ってくる。MyResourceのところはxcdatamodeldの名前で良いのかな?かな?そうかな?

自分の所ではResourceの名前の書き換えをやっていたらしく間違った設定が元々書いてあって結構時間を無駄にしてしまったと言う…。

今ちょっと急いでてあれこれ検証できないけど貼っとく!ごめん!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1