Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RashiMahajan

macrumors newbie
Original poster
Apr 17, 2009
22
0
In my app, i m posting some data to the server, in return expecting some acknowledgment msgs. Accordingly displaying the pop-up on UI for informing the user for success or Failure.

When i post the data for more than two times to server, i should get two pop-up but here i get three pop-ups. At very first pop - up appears & disappears then again pop appears, now t wait for user click after that other appears.

I am using simple code in loop..

Code:
/*........... 
if([nss_value isEqualToString:@"0"]) 
{ [self showAlert:@"Success" :nil]; } 
else { [self showAlert:@"Failure" :nil]; } 
................*/

-(void)showAlert:(NSString *)nss_title:(NSString *)nss_msg
 { 
NSLog(@"SHOW ALERT IS UPP"); 
UIAlertView *uialv_userConfirmation =[[UIAlertView alloc]initWithTitle:nss_title message:nss_msg delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok",nil];
 [uialv_userConfirmation show]; 
[uialv_userConfirmation release]; 
uialv_userConfirmation=nil; 
}
Can anybody help me ....... :(
 
Last edited by a moderator:
In my app, i m posting some data to the server, in return expecting some acknowledgment msgs. Accordingly displaying the pop-up on UI for informing the user for success or Failure.

When i post the data for more than two times to server, i should get two pop-up but here i get three pop-ups. At very first pop - up appears & disappears then again pop appears, now t wait for user click after that other appears.

I am using simple code in loop..

Code:
/*........... 
if([nss_value isEqualToString:@"0"]) 
{ [self showAlert:@"Success" :nil]; } 
else { [self showAlert:@"Failure" :nil]; } 
................*/

-(void)showAlert:(NSString *)nss_title:(NSString *)nss_msg
 { 
NSLog(@"SHOW ALERT IS UPP"); 
UIAlertView *uialv_userConfirmation =[[UIAlertView alloc]initWithTitle:nss_title message:nss_msg delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok",nil];
 [uialv_userConfirmation show]; 
[uialv_userConfirmation release]; 
uialv_userConfirmation=nil; 
}
Can anybody help me ....... :(


You will need to post more code if you want help. The current context doesn't tell the entire story, specifically what\where the if statements are.


Side Note:
May I ask why you're comparing a string of 0? You may want to name your method parameters. (You are not truly naming your parameters as much as making the methods more descriptive)

Code:
-(void)showAlert:(NSString *)nss_title:(NSString *)nss_msg

could be 

-(void)showAlertWithTitle:(NSString *)nss_title andMessage:(NSString *)nss_msg


This will help you while coding and help others read your code if you have a question.
 
...i should get two pop-up but here i get three pop-ups. At very first pop - up appears & disappears then again pop appears, now t wait for user click after that other appears.

Not three pop-ups, but rather this kind of sequence:
  1. Show popup #1
  2. Show popup #2
  3. Click to dismiss
  4. Show popup #1 again

If you want a maximum of one pop-up, then use an instance variable and programmatically dismiss any existing UIAlertView before instantiating a new one. Good luck :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.