2014-02-19 63 views
0

這是我在AppDelegatesearchDisplayController消息

iMapView = [[iMapViewController alloc] init]; 
    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 
    { 
     CGSize result = [[UIScreen mainScreen] bounds].size; 
     if(result.height == 568) 
     { 
      iMapView.view.frame = CGRectMake(0, 0, 568, 320); 
     } 
    } 

    [viewController.view addSubview:iMapView.view]; // crashing here 

我打開NSZombie,發現問題代碼:

[iMapViewController searchDisplayController]: message sent to deallocated instance 0xd81d740 

但我還從來沒有使用searchDisplayController或任何地方的代表。

@interface iMapViewController : UIViewController<UIAlertViewDelegate> 

它只發生在iOS 7與非ARC。

你能給我一些建議嗎?

謝謝

+1

檢查xib,你是如何創建iMapViewController的?像從其他類複製粘貼或從文件創建新的 - > newFile – Rajneesh071

+0

我從代碼創建我的看法,我的xib是空的 –

+0

什麼是你的xib名稱,把你的xib名稱放在你的代碼中.. – Rajneesh071

回答

1

一旦這樣做,不要讓你的視圖控制器的全局實例。

iMapViewController *newObject = [[iMapViewController alloc]initWithNibName:@"iMapViewController" bundle:nil]; 

可能是您正在釋放您的iMapView並再次訪問它。