LoginSignup
2
1

More than 5 years have passed since last update.

Missing proxy for identifier IBFilesOwnerエラーで落ちる原因と対処法

Last updated at Posted at 2014-03-06

現象

  • UITableViewCell に、 reloadRowsAtIndexPaths:withRowAnimation: でテーブルセルのリロードをかけるとアプリが落ちる。
  • アニメーションを UITableViewRowAnimationNone にしてもダメ。

エラーメッセージ

 Missing proxy for identifier IBFilesOwner

原因

  • 画面の更新系の処理をBackgroundで実行しようとしていたことが原因。
  • 自分は、通信しその結果をテーブルへ反映させるという処理を、すべてBackgroundスレッドで実行するコードを書いていたのが原因でした。

解法法

  • メインスレッドで実行する

サンプルコード

    dispatch_async(dispatch_get_main_queue(), ^{
            [self reloadRowsAtIndexPaths:@[indexPath]
                        withRowAnimation:UITableViewRowAnimationFade];
    }

これでエラーは解消する。

ただ、実際にはreloadRowsAtIndexPaths:だけでなくメソッド全体をメインスレッドで呼び出すように変更しました。
「データの取得等をしているクラス」と「テーブルクラス」が別クラスなので、前者は極力バックグラウンドで実行、後者はメインスレッドで実行される前提でコーディング。
前者から後者へのメソッド呼び出し時にメインスレッドへ戻す、という整理です。

メモ

  • NotificationCenter経由で通知しても、通知元がバックグラウンドスレッドだったら通知を受け取る側もバックグラウンドで動くんですね。知りませんでした。
  • もっといい方法や気になる点があれば、気軽にコメントください。

参考リンク

objective c - Missing proxy for identifier IBFilesOwner - Stack Overflow
http://stackoverflow.com/questions/10937103/missing-proxy-for-identifier-ibfilesowner

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