错误:无法识别的选择器发送到实例 [英] Error: unrecognized selector sent to instance

查看:126
本文介绍了错误:无法识别的选择器发送到实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义对象 Spaces

#import "Spaces.h"


@implementation Spaces

@synthesize spaceName;
@synthesize spaceUsers;
@synthesize spaceIcon;
@synthesize spaceID;

@synthesize imageURLString;


- (void)dealloc
{
    [spaceName release];
    [spaceUsers release];
    [spaceIcon release];

    [imageURLString release];

    [super dealloc];
}

@end

我的根视图控制器 cellForRowAtIndexPath:并从 NSArray / p>

My root view controller implements a cellForRowAtIndexPath: and grabs from an NSArray of Spaces:

    [[cell spaceName] setText:aSpace.spaceName];
    [[cell spaceChatType] setText:@"People"];
    [[cell spaceActiveUsers] setText:aSpace.spaceUsers];

这个工作正常,我可以点击进入详细视图并返回列表,可能在表视图和详细视图之间来回5-6次点击,我在 [[cell spaceName] setText:aSpace.spaceName]; p>

This works fine and I can click to go into the detail view and back to the list, but after maybe 5-6 clicks back and forth between the table view and detail view, I get an error at [[cell spaceName] setText:aSpace.spaceName]; which is


' - [__ NSCFSet spaceName]:无法识别的选择器发送到实例0x6047b90

'-[__NSCFSet spaceName]: unrecognized selector sent to instance 0x6047b90'"

请帮助!任何洞察力将非常感激!

Please help! Any insight will be very appreciated!

更新:

我仍然得到相同的错误,但我把它缩小到这:

I'm still getting the same error but I've narrowed it down to the this:

- 我在didSelectRowAtIndexPath ...创建一个详细视图控制器...
- 详细视图正在push到viewcontroller并且显示正常,我有一个后退按钮添加
- 详细视图加载信息和刷新计时器
- 按后退按钮去回到表列表视图

-I'm creating a detail view controller on didSelectRowAtIndexPath... -The detail view is being pushed to the viewcontroller and displays fine, I have a back button added as well. -The detail view loads information and refreshes on a timer -Pressing the back button goes back to the table list view

这是我的细节视图不是从内存释放的问题,所以我越来越多的视图之间来回去更多的计时器关闭。我添加了一个检查viewWillDisappear,通过设置一个bool值停止计时器。

This is the problem my detail view is not being released from memory so the more I go back and forth between the views the more timers were going off simultaneously. I added a check to viewWillDisappear that stops the timer by setting a bool value.

我注意到细节视图不卸载...

I noticed that the detail view is not unloading...

从RootViewController:

From the RootViewController:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //no longer on initial view
    isinit = NO;

    //hide keyboard
    [spacesSearch resignFirstResponder];

    if (spaces != nil && spaces.count > 0)
    {
        //set back button reference
        UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Spaces" style:UIBarButtonItemStylePlain target:self action:@selector(returnSpacesList:)];  
        self.navigationItem.backBarButtonItem = backButton;

        [backButton release];

        DetailViewController *details = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]; 

        //Grab Data from selected Space object and pass to DetailViewController
        Spaces *aSpace = nil;
        if (tableView == self.searchDisplayController.searchResultsTableView)
        {
            if ([self.filteredListContent count] == 0)
            {
                //self.lastSearchText
                NSLog(@"Create new space code!");
            }
            else
            {
                aSpace = [self.filteredListContent objectAtIndex:indexPath.row];
            }
        }
        else
        {
            aSpace = [spaces objectAtIndex:[indexPath row]];
        }

        //set title and display
        self.navigationController.title = [NSString stringWithFormat:@"/%@/",aSpace.spaceName];

        //pass data
        [details passedValue:aSpace.spaceID :aSpace.spaceName];

        [self.navigationController pushViewController:details animated:YES];

        [aSpace release];
        [details release];

    }
}

如何强制细节视图

谢谢

推荐答案

[cell spaceName] 已被autoReleased。我看不到你如何定义,但看看你的代码部分。

如果你需要更多的帮助,你需要提供更多的代码。

It sounds like [cell spaceName] has been autoReleased. I cannot see how you have defined that, but take a look at that part of your code.
If you need more help, you need to provide more code.

这篇关于错误:无法识别的选择器发送到实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆