2012-05-10 19 views
2

「ゾンビオブジェクト」を有効にすると、このエラー(「ViewController respondsToSelector:]:メッセージが割り当て解除されたインスタンスに送信されました」)が表示されます。私はエラーがどこにあるのか分かりましたが、解決方法はわかりません。 ViewController.hViewController respondsToSelector:]:解放されたインスタンスにメッセージが送信されました

#import <UIKit/UIKit.h> 

@interface ViewController : UIViewController <UISearchDisplayDelegate, UISearchBarDelegate>{ 


    // The saved state of the search UI if a memory warning removed the view. 
    NSString  *savedSearchTerm; 
    NSInteger  savedScopeButtonIndex; 
    BOOL   searchWasActive; 
} 

@property (nonatomic, copy) NSString *savedSearchTerm; 
@property (nonatomic) NSInteger savedScopeButtonIndex; 
@property (nonatomic) BOOL searchWasActive; 

ViewController.m

... 
// when I comment out "viewDidDisappear" everything is ok, how to solve this on different way? 
- (void)viewDidDisappear:(BOOL)animated 
{ 
    // save the state of the search UI so that it can be restored if the view is re-created 
    self.searchWasActive = [self.searchDisplayController isActive]; 
    self.savedSearchTerm = [self.searchDisplayController.searchBar text]; 
    self.savedScopeButtonIndex = [self.searchDisplayController.searchBar selectedScopeButtonIndex]; 
}... 

あなたは[スーパーviewDidDisappear:アニメーション]置くべき助け

+0

これまでにこの問題を解決しましたか?私は同じ問題を抱えている。 – achi

+0

@EliGregory - はい。私はviewDidDisappearをコメントします:) – CroiOS

+2

私はそのメソッドをオーバーライドしていないので、他の人が見ないといけません。 – achi

答えて

0
/* 
- (void)viewDidDisappear:(BOOL)animated 
{ 
    // save the state of the search UI so that it can be restored if the view is re-created 
    self.searchWasActive = [self.searchDisplayController isActive]; 
    self.savedSearchTerm = [self.searchDisplayController.searchBar text]; 
    self.savedScopeButtonIndex = [self.searchDisplayController.searchBar selectedScopeButtonIndex]; 
} 
*/ 
0

のための感謝の:でここ

コードですデフォルトの実装であるように、オーバーライドの開始点イオン。その行を忘れると問題を引き起こすことがあります。

編集:

私はあなたには、いくつかのより多くのコードを投稿する必要かもしれないと思います。鍵は、あなたがやっていることにほかならないかもしれません。

+0

ありがとうございますが、それは問題ではありません。 – CroiOS

2

このエラーを「作成」していますか?

私のケースでは、私はナビゲーションスタックからViewControllerをポップし、まだこのVCに送られたNSNotificationsがありました。すべてのオブザーバーを私のVCに移すのを忘れてしまった。

関連する問題