我正在开发一个简单的基于视图的应用程序,其中包含两个按钮和一个解析rss feed.my视图的表视图在顶部有两个按钮,我从界面builder...ive添加uitableview,添加委托和表视图的数据源作为文件的owner....the解析过程在一个单独的文件中完成,我正在使用delgation来接收解析的data....every东西工作良好,除了self.tableView reloadData,它给出一个错误,如果我要评论这个,我没有得到要加载到表视图中的数据...如果im要创建基于导航的application.but,则解析数据的....this加载工作良好。如果我要创建基于视图的应用程序并从接口构建器编程添加表视图,则会产生问题,cud你们帮我out....below就是代码..
@implementation FirstViewController
@synthesize items;
@synthesize items2;
- (void)viewDidLoad
 {
    [super viewDidLoad];
    [self loadData];
}
-(void)loadData
{
if (items==nil) 
    {
Parser1 *rssparser=[[Parser1 alloc]init];   
rssparser.delegate=self;
[UIApplication sharedApplication].networkActivityIndicatorVisible=YES;
[activityIndicator startAnimating];
[rssparser startRssFeed:@"http://api.flickr.com/services/feeds/photos_public.gne"];
        [rssparser release];
    }else
    {
        //[self.tableView reloadData];
    }
}
-(void)receiveFeeds:(NSArray *)theItems
{   
[UIApplication sharedApplication].networkActivityIndicatorVisible=NO;
[activityIndicator stopAnimating];
items=theItems;
NSLog(@"ha ha ha items:%@",items);
    //[self.tableView reloadData];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [items count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
reuseIdentifier:CellIdentifier] autorelease];
 }
    cell.textLabel.text=[[items objectAtIndex:indexPath.row]objectForKey:@"title"];
    cell.textLabel.text=@"hello";
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
   return cell;
}发布于 2011-04-18 16:27:32
尝试在环境设置中使用NSZombieEnabled = YES来运行你的应用。也许你在某处遇到了内存分配问题。
我有根据的猜测是: items=theItems;
您不保留items数组,它会在您使用它之前自动释放
https://stackoverflow.com/questions/5699985
复制相似问题