LoginSignup
2
3

More than 5 years have passed since last update.

CoreData at Github

Last updated at Posted at 2015-11-06

Getting Started1

開始するためにまず、あなたのプロジェクトの"pchファイル"にMagicalRecord.h headerfileをimport(外部データを取り入れる。)しましょう

これは、必要とするすべてのheaderファイルを"グローバルインクルード"を許可するためです。

もしあなたがCocoaPodsやMagicalRecord.frameworkを利用してimportをするならこんな感じでやりましょう。

// Objective-C
#import <MagicalRecord/MagicalRecord.h>
// Swift
import MagicalRecord

もしくは、あなたがMagicalRecord's source filesObjective-C projectに直接追加したいなら、あなたはこんな感じでやる必要があります。

#import "MagicalRecord.h"

Getting Started2

次にiOSアプリのDelegateファイルで次のMagicalRecord Classの"Setup calls" => setupCoreDataStackメソッドのうちの一つを使います。このメソッドには、初期化の意味合いとデータの永続保存の設定の意味合いがあります。
そしてapplicationDidFinishLaunching: withOptions: methodかもしくはawakeFromNibで使用します。

+ (void)setupCoreDataStack;
+ (void)setupAutoMigratingCoreDataStack;
+ (void)setupCoreDataStackWithInMemoryStore;
+ (void)setupCoreDataStackWithStoreNamed:(NSString *)storeName;
+ (void)setupCoreDataStackWithAutoMigratingSqliteStoreNamed:(NSString *)storeName;
+ (void)setupCoreDataStackWithStoreAtURL:(NSURL *)storeURL;
+ (void)setupCoreDataStackWithAutoMigratingSqliteStoreAtURL:(NSURL *)storeURL;

それぞれの呼び出しは、CoreDataStackの各部分のいずれかをインスタンス化し、getter/setterメソッドをインスタンスに提供します。これらはMagicalRecordのインスタンスとして知られていて、そして初期設定として認められています。

あなたのiOSアプリが終了するときに、あなたは"cleanUp"クラスメソッドを呼び出す必要があります。

[MagicalRecord cleanUp];

学習

pchファイル
グローバルインクルード
セットアップコール

参考URL

https://github.com/magicalpanda/MagicalRecord
http://qiita.com/key/items/1bbd72abc54e52639041

2
3
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
2
3