简体   繁体   中英

iPhone: receiving warning on clicking uialertview cancel or other button

warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.4 (8K2)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).

- (void)showReminder:(NSString *)text
{
    NSLog(@"alert text>>%@",text);
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Reminder" 
                                                        message:text delegate:self
                                              cancelButtonTitle:@"Ok"
                                              otherButtonTitles:@"Snooze",nil];
    [alertView show];

    [alertView release];

}


-(void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{

NSString *title = [alertView buttonTitleAtIndex:buttonIndex]; 

    NSLog(@"alert title>>%@",title);
    if(buttonIndex == 0)  
    {  
        NSLog(@"Button 1 was selected.");  
    }  
    else if([title isEqualToString:@"Snooze"])  
    {  
        NSLog(@"check")
    }

}

Why not have this instead:

- (void)showReminder:(NSString *)text {

   NSLog(@"alert text>>%@",text);
   UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Reminder" 
                                                 message:text 
                                                 delegate:self
                                                 cancelButtonTitle:@"Ok"
                                                 otherButtonTitles:@"Snooze",nil];
   [alertView show];

   [alertView release];

}


-(void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{    

    if(buttonIndex == 0)  {  
       NSLog(@"Button 1 was selected.");  
    }  
    else if(buttonIndex == 1){  
        NSLog(@"check")
    }

}

when buttonIndex is 1 then that is your snooze button. If you have other alerts then just apply a tag in showReminder alertView.tag = 1 and in your clickedButtonAtIndex add an outer if saying

if(alertView.tag==1)

And for that error check out this question . They seem to have solved how to fix the missing symlink you need

Respond to Alert Button Selection

@interface ViewController : UIViewController <UIAlertViewDelegate> {

Create UIAlertview

UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Hello World!"
                                              message:@"This is your first UIAlertview message."
                                             delegate:self
                                    cancelButtonTitle:@"Button 1"
                                    otherButtonTitles:@"Button 2", @"Button 3", nil];
[message show];

And

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    NSString *title = [alertView buttonTitleAtIndex:buttonIndex];

    if([title isEqualToString:@"Button 1"])
    {
        NSLog(@"Button 1 was selected.");
    }
    else if([title isEqualToString:@"Button 2"])
    {
        NSLog(@"Button 2 was selected.");
    }
    else if([title isEqualToString:@"Button 3"])
    {
        NSLog(@"Button 3 was selected.");
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM