为什么单击任何按钮时我的UIActionSheet会崩溃?

时间:2012-12-08 14:31:30

标签: iphone ios objective-c uiactionsheet

我的UIActionSheet有问题。当我点击任何按钮时它会崩溃。我已激活NSZombieEnabled。然后,我收到以下错误消息。

[FacebookConfigurationController actionSheet:clickedButtonAtIndex:]: message sent to
deallocated instance 0x84d4430

我在我的方法中放了一个断点

-(void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger) index

但在停止前崩溃。这是我的代码,如果你可以帮助我

FacebookConfigurationController.h

@interface FacebookConfigurationController: UIViewController<UIActionSheetDelegate,...>

FacebookConfigurationController.m

-(void) LaunchFacebookMenu
{    
     if([Commentaire isEqual:@""])
    {
        NSLog(@"You must enter a comment");
    }
    else
    {
        UIActionSheet *action = [[UIActionSheet alloc] initWithTitle: [self getLanguageValue: @"facebook_popup_title"]
                                                            delegate: self 
                                                   cancelButtonTitle: nil 
                                              destructiveButtonTitle: 
                                 [self getLanguageValue: @"facebook_popup_cancel"]
                                                   otherButtonTitles: 
                                 [self getLanguageValue: @"facebook_popup_userwall"], 
                                 [self getLanguageValue: @"facebook_popup_friendwall"],
                                 [self getLanguageValue: @"facebook_popup_deconect"],nil];
        action.actionSheetStyle =UIActionSheetStyleBlackTranslucent;

        [action showInView:m_CurrentView.view];
        [action release];
    }
}




- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)Index
{ 
    switch (Index) 
    {

        case 0:
        {
            [m_CurrentView dismissModalViewControllerAnimated:YES];   
            break;
        }
        case 1:
        {

         ...
         ...
         ...

1 个答案:

答案 0 :(得分:1)

您是否已发布FacebookConfigurationController object

因为委托方法

(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)Index{}
释放"self"后很快就会调用