I'm developing an iphone application and i have small problem on it. I'm using popup caller methods into my appdelegate.m file bellow like that
-(void)OpenInfo{
InfoDetail *detail = [[InfoDetail alloc] initWithNibName:@"InfoDetail" bundle:nil];
self.infoDetail = detail;
[detail release];
[window addSubview:detail.view];
}
-(void)OpenNetworkSelection{
NetworkSelection *netsel = [[NetworkSelection alloc] initWithNibName:@"NetworkSelection" bundle:nil] ;
self.networkselection = netsel;
[netsel release];
[window addSubview:netsel.view];
}
And I'm calling these methods from inside of views like that
StatusFoxAppDelegate *delegate = (StatusFoxAppDelegate*)[[UIApplication sharedApplication] delegate];
[delegate OpenInfo];
And these helper views and opener views communicating via NSNotificationCenter.
My problem is as you can see "OpenInfo" and "OpenNetworkSelection" methods contains view instance creation logics.
When i called OpenInfo method it's working perfect as should be. But "OpenNetworkSelection" isn't working it's throwing when i tried second time *** -[UIButton release]: message sent to deallocated instance 0x3dbdb50 error.
Ok I understood that. Then i put NSlog line into the Dealloc overload of NetworkSelection.m
and OpenInfo.m files, because i need to differences of behaviours.
So, OpenInfo dealloc methods is working on when the view closed (I mean removed from superview). But NetworkSelection's dealloc method executing three times. I didn't find to problem source.
Can someone tell me, what i'm doing wrong ?
Thank you
Edit :
Guys, i found something wrong into my NetworkSelection view controller. More description is; i saw these lines of code into my viewcontroller.
CommonGateway *gw = [[CommonGateway alloc] InitWithDefaults];
self.gateway = gw;
[self.gateway GetAvailableNetworkList];
[self.gateway setCommDelegate:self];
[gw release];
In these lines of code i'm making async server calls, when i commented out these lines, my viewcontroller worked perfectly, then i created "LoadDataFromServer" method and i passed CommonGateway instance from source that appdelage like that
- (void)LoadDataFromServer{
CommonGateway *gw = [[CommonGateway alloc] InitWithDefaults];
self.gateway = gw;
[self.gateway GetAvailableNetworkList];
[self.gateway setCommDelegate:self];
[gw release];
}
My appdelegate code change to;
-(void)OpenNetworkSelection{
NetworkSelection *netsel = [[NetworkSelection alloc] initWithNibName:@"NetworkSelection" bundle:nil] ;
self.networkselection = netsel;
self.networkselection.gateway = commonGateway;
[netsel release];
[window addSubview:self.networkselection.view];
[self.networkselection LoadDataFromServer];
}
But result same, if i comment out "[self.networkselection LoadDataFromServer];" line then it's working. And my CommonGateway class notify to caller via NSNotificationCenter.
I think it will be gives more clue for solving problem.
Thank you again