SwiftでMagicalRecordを使うときは、@objc(Entity名)を忘れずに。


Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 2692

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798
LINEで送る
Pocket

Swiftを使ってコードを書いています。
Objective-Cで書かれたコードも、しっかりと使えるようにサポートしていて書き方こそ違えど、大体はそのままSwiftに持ち込んでも問題ないと思っています。

しかし、MagicalRecordを使ってCoreDataを触っていると存在しないエンティティにアクセスしていると実行時にエラーでアプリが落ちることがありました。

magicalpanda/MagicalRecord

正直、皆目検討が付かず3時間は悩んでいたと思うのですがふとしたことで、対策を思いつきました。

結局原因は、SwiftのオブジェクトをObjective-C側で操作できるようにする方法を提供していないことでした。

@objec(Entityクラス名)

を書いておくだけです。

これは、NSManagedObjectのサブクラスをSwiftで書いた場合で、MagicalRecordを使う場合には必須の作業っぽいので忘れないようにメモしておきます。

これからも更新を続けていきますので、Feedlyへの登録をお願いします!

follow us in feedly

LINEで送る
Pocket


Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

コメントを残す
Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/jagaimopotato/www/html/blog/wp-includes/formatting.php on line 4798