好吧我正在尋找這個錯誤,因爲2小時,我只是不能弄明白,請幫助我。 我有以下情況我有2個viewcontroller。 一個呈現另一個像這樣的modalview。消息發送到解除分配的實例!不能找到錯誤
SearchViewController *searchViewController = [[SearchViewController alloc]init];
[searchViewController setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
searchViewController.delegate = self;
searchViewController.senderTag = [sender tag];
[self presentModalViewController:searchViewController animated:YES];
[searchViewController release];
在我searchviewcontroller
我這樣做在.m文件我合成它.h文件
BSKmlResult *selectedAirport;
@property (nonatomic, retain) BSKmlResult *selectedAirport;
然後將其設置這樣
selectedAirport = [self.airportList objectAtIndex:indexPath.row];
,然後再釋放這裏
- (void)dealloc {
[selectedAirport release];
[super dealloc];
}
在我SearchViewController的代表梅索德這是在第一 視圖 - 控制實現,其中我也介紹了SearchViewController 我有以下
if (controller.selectedAirport) {
if (departureAirport) {
[departureAirport release];
}
departureAirport = [controller.selectedAirport copy];
}
[self dismissModalViewControllerAnimated:YES];
我縮小在錯誤發生它在我SearchViewController 的的dealloc [selectedAirport release];
,但我無法揣摩出我的錯誤是 請幫
你是完全正確的!將其更改爲self.selectedAirport,它的功能就像魅力一樣!我確實不知道這一點,我對這一切都很陌生。還有一個問題我什麼時候使用自我。什麼時候不?有沒有規則?礦石我是否總是使用自我。 ? – bllubbor 2011-05-20 14:48:03
@bllubbor - 我總是使用自我,從來沒有任何問題。 – Rayfleck 2011-05-20 14:50:51
它很簡單,只要你想訪問屬性就使用自己。但我個人使用自己來「設置」,而不是「得到」。 – 2011-05-20 14:56:28