Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当我在桌上一行上下移动时,Iphone xcode模拟器崩溃_Iphone_Xcode - Fatal编程技术网

当我在桌上一行上下移动时,Iphone xcode模拟器崩溃

当我在桌上一行上下移动时,Iphone xcode模拟器崩溃,iphone,xcode,Iphone,Xcode,我无法理解这件事。当页面加载时,一切正常-我可以上下钻取,但是当我在tableview上上下拉时,“流”(在我下面突出显示的位置)变得不等于任何东西。但这种错误只是偶尔发生的。通常它返回键/对 如果知道,您可以理解上面如何测试//(int)[$VAR count]}键/值对 在NSMutableDictionary对象中 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPa

我无法理解这件事。当页面加载时,一切正常-我可以上下钻取,但是当我在tableview上上下拉时,“流”(在我下面突出显示的位置)变得不等于任何东西。但这种错误只是偶尔发生的。通常它返回键/对

如果知道,您可以理解上面如何测试//(int)[$VAR count]}键/值对 在NSMutableDictionary对象中

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *FirstLevelCell = @"FirstLevelCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:FirstLevelCell];
    if(cell == nil)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:FirstLevelCell] autorelease];
    }

    NSInteger row = [indexPath row];
    //NSDictionary *stream = (NSDictionary *) [dataList objectAtIndex:row];


    NSString *level = self.atLevel;
    if([level isEqualToString:@"level2"])
    {
        NSMutableDictionary *stream = [[NSMutableArray alloc] init];
        stream = (NSMutableDictionary *) [dataList objectAtIndex:row];
//流值为(int)[$VAR count]}键/值对

        if ([stream valueForKey:@"title"] ) 
        {
            cell.textLabel.text = [stream valueForKey:@"title"];
            cell.textLabel.numberOfLines = 2;
            cell.textLabel.font =[UIFont systemFontOfSize:10];

            NSString *detailText = [stream valueForKey:@"created"];
            cell.detailTextLabel.numberOfLines = 2;
            cell.detailTextLabel.font= [UIFont systemFontOfSize:9];
            cell.detailTextLabel.text = detailText; 

            NSString *str = @"http://www.mywebsite.co.uk/images/stories/Cimex.jpg";
            NSData *imageURL = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:str]];
            UIImage *newsImage = [[UIImage alloc] initWithData:imageURL];

            cell.imageView.image = newsImage;

            [stream release];
        }
    }
    else 
    {
        cell.textLabel.text = [dataList objectAtIndex:row];
    }


    return cell;
}

谢谢你抽出时间

我不太明白这个问题,但是

您可以通过以下方式测试字典中的值数:

if ([[myDictionary allKeys] count] == someNumber) {
    // do something...
}

我不太明白这个问题,但是

您可以通过以下方式测试字典中的值数:

if ([[myDictionary allKeys] count] == someNumber) {
    // do something...
}

您正在泄漏和过度发布流字典:

NSMutableDictionary *stream = [[NSMutableArray alloc] init]; // <-- Create a new dictionary
stream = (NSMutableDictionary *) [dataList objectAtIndex:row]; // <-- Overwrite the reference with another dictionary. Previous dictionary is lost...

...

[stream release]; // <-- You are releasing an object you don't have the ownership.

NSMutableDictionary*stream=[[NSMutableArray alloc]init];// 您正在泄漏和过度发布流字典:

NSMutableDictionary *stream = [[NSMutableArray alloc] init]; // <-- Create a new dictionary
stream = (NSMutableDictionary *) [dataList objectAtIndex:row]; // <-- Overwrite the reference with another dictionary. Previous dictionary is lost...

...

[stream release]; // <-- You are releasing an object you don't have the ownership.

NSMutableDictionary*stream=[[NSMutableArray alloc]init];//为什么要将可变数组分配给dictionary对象,然后重新分配它?您正在泄漏内存…可能不是您的问题,但仍然是一个问题。您为什么要将可变数组分配给dictionary对象,然后重新分配它?您正在泄漏内存…可能不是您的问题,但仍然是一个问题代码工作正常,但我可以将“myDictionary”设置为(int)[$VAR count]}键/值对-我需要对此进行真正的测试。这与EXC_BAD_访问问题有关。代码工作正常,但我可以将“myDictionary”设置为(int)[$VAR count]}键/值对-我需要对此进行真正的测试。这与EXC\u BAD\u访问问题有关。