【问题标题】:Why does my UIActionSheet crashes when any button is clicked?为什么单击任何按钮时我的 UIActionSheet 会崩溃?
【发布时间】:2012-12-08 14:31:29
【问题描述】:

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

[FacebookConfigurationController actionSheet:clickedButtonAtIndex:]: 消息发送到 释放实例 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:
        {

         ...
         ...
         ...

【问题讨论】:

    标签: iphone ios objective-c uiactionsheet


    【解决方案1】:

    你释放你的FacebookConfigurationController object了吗?

    因为委托方法

    (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)Index{}
    

    当你释放"self"时很快被调用。

    【讨论】:

      猜你喜欢
      • 2016-05-24
      • 1970-01-01
      • 2013-09-16
      • 1970-01-01
      • 2012-07-22
      • 1970-01-01
      • 2020-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多