Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.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
Ios RestiKit使iPhone在下载时速度过慢_Ios_Restkit - Fatal编程技术网

Ios RestiKit使iPhone在下载时速度过慢

Ios RestiKit使iPhone在下载时速度过慢,ios,restkit,Ios,Restkit,我正在通过WIFI从iPhone连接到Mac上本地安装的网络服务 我将四组数据加载到TableView中,每一组都有不同的请求。第一次下载完成后,我将数据加载到TableView中,并继续进行以下下载 当RestKit运行时,应用程序几乎死机。您只能勉强滚动TableView,并且必须等到下载过程完成后才能工作 我怎样才能使RestKit在我的设备上不那么沉重,这样我就可以在工作时安静地下载数据 编辑: 在设备中运行时,我注意到控制台中出现以下消息: warning: Unable to rea

我正在通过WIFI从iPhone连接到Mac上本地安装的网络服务

我将四组数据加载到TableView中,每一组都有不同的请求。第一次下载完成后,我将数据加载到TableView中,并继续进行以下下载

当RestKit运行时,应用程序几乎死机。您只能勉强滚动TableView,并且必须等到下载过程完成后才能工作

我怎样才能使RestKit在我的设备上不那么沉重,这样我就可以在工作时安静地下载数据

编辑:

在设备中运行时,我注意到控制台中出现以下消息:

warning: Unable to read symbols for /Users/david/Library/Developer/Xcode/iOS DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/info/dns.so (file not found).
warning: No copy of dns.so found locally, reading from memory on remote device.  This may slow down the debug session.
我仍在试图理解其中的含义

AppDelegate。我初始化AEMEventoList并调用downloadEventos方法开始下载

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.   


    //Original code
    AEMMasterViewController *masterViewController = [[[AEMMasterViewController alloc] initWithNibName:@"AEMMasterViewController" bundle:nil] autorelease];

    //Inicializar lista de eventos
    AEMEventosList *aux = [[AEMEventosList alloc] init];
    aux.delegate = masterViewController;

    //Asignar la lista de eventos a la variable miembro de la clase
    self.eventosList = aux;
    [aux release];

    // Comenzar la descarga de eventos desde el servidor
    [self.eventosList downloadEventos];

    //Orignal code
    self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
//    self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.71 green:0.45 blue:0.05 alpha:1];
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];


    return YES;
}
AEMEventoList inti方法:

-(id)init {
    self = [super init];
    if (self) {    
        self.eventos = [NSMutableDictionary dictionary];
        self.downloadingEventosGroupFlag = 0;
        self.eventosGroupNames = [NSArray arrayWithObjects:
                                             kEventosToday, 
                                             kEventosInAWeek, 
                                             kEventosInAMonth, 
                                             kEventosLaterThanAMonth, 
                                             nil];

        //Iniciar el manager
        self.manager = [RKObjectManager objectManagerWithBaseURL:kRestURL];

        //Mapeo de atributos JSON a miembros de la clase AEMEvento
        RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[AEMEvento class]];
        [mapping mapAttributes:
         kIdEvento,
         kNombreEvento,
         kEntradilla,
         kDescripcion,
         kDiaDeInicio,
         kDiaDeFin,
         kHorarioTexto,
         kIdFuente,
         kNombreFuente,
         kFotoURL,
         kWebURL,
         kUbicaciones,
         kHorarios,
         kDiaDeInicioYFinTexto,
         nil];


        //Especificar el mapeo de fechas
        NSDateFormatter* dateFormatter = [NSDateFormatter new];
        [dateFormatter  setDateFormat:kDateFormatStringForJson];
        [dateFormatter setTimeZone:[NSTimeZone defaultTimeZone]];
        mapping.dateFormatters = [NSArray arrayWithObject:dateFormatter];
        [dateFormatter release];    

        //Asignar el mapeo al manager siempre que se encuentre la clave "eventos" en el archivo JSON
        [self.manager.mappingProvider setMapping:mapping forKeyPath:kEventos];        
    }
    return self;
}
AEMEventoList下载事件方法

-(void)downloadEventos {            

    //Iniciar la descarga del grupo de eventos indicado por el atributo downloadingEventosGroupFlag
    [self.manager loadObjectsAtResourcePath:[self.eventosGroupNames objectAtIndex:self.downloadingEventosGroupFlag] delegate:self];

    //Enviar al delegado el mensaje de incio de descarga para que muestre la vista con el indicador de progreso.
    [self.delegate AEMEventosListDidStartLoadingEventos:self];

}
表视图委托方法:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return [self.eventosList.eventos count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [[self.eventosList.eventos objectForKey:[self.eventosList.eventosGroupNames objectAtIndex:section]] count];
}

    -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        return 80;
    }

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    switch (section) {
        case 0:
            return NSLocalizedString(@"Today", @"Today's events tableview section title.");
            break;
        case 1:
            return NSLocalizedString(@"In a week", @"In a week's events table view section title.");
            break;
        case 2:
            return NSLocalizedString(@"In a month", @"In a month's events tableview section title.");
            break;
        case 3:
            return NSLocalizedString(@"Later than a month" , @"Later than a month events tableview section title.");
            break;
        default:
            return nil;
            break;
    }

}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    //Obtener el evento de la lista para la celda
    NSArray *aux = [self.eventosList.eventos objectForKey:[self.eventosList.eventosGroupNames objectAtIndex:indexPath.section]];
    AEMEvento *auxEvento = [aux objectAtIndex:indexPath.row];


    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;        

        cell.selectionStyle = UITableViewCellSelectionStyleNone;

        cell.textLabel.textColor = [UIColor colorWithRed:0.2 green:0.3 blue:0.5 alpha:1];
        cell.textLabel.font = [UIFont systemFontOfSize:13];
        cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
        cell.textLabel.numberOfLines = 2;

        cell.detailTextLabel.textColor = [UIColor lightGrayColor];
        cell.detailTextLabel.font = [UIFont systemFontOfSize:11];
        cell.detailTextLabel.textAlignment = UITextAlignmentRight;
    }

    // Configure the cell.
    cell.textLabel.text = auxEvento.nombreEvento;
    cell.detailTextLabel.text = auxEvento.diaDeInicioYFinTexto;
    NSString *path = [[NSBundle mainBundle] pathForResource:@"iconGijonBlanco" ofType:@"png"];
    cell.imageView.image = [UIImage imageWithContentsOfFile:path];  
    return cell;
}

// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return NO;
}

您能否发布用于调用请求的代码以及完成请求时用于处理请求的代码?在没有看到这一点的情况下,听起来您是在实例化请求并在主线程上运行它们,而不是使用异步并将请求传递给后台线程。

RestKit与此问题无关。加载数据后,我有一个循环处理下载的每个元素(大约400次)。虽然模拟器每秒可以循环100次,但设备每秒只能处理4次。我必须搜索正在发生的事情,但我将就此打开一个新的线程,因为这是一个与原始问题不同的问题。

您希望人们像那样回答您的问题,而不看您的代码吗?有时有一个简单的答案,而不必粘贴一行又一行代码。也许你是对的,最好提前做好准备,以免浪费时间。对不起,您可以发布tableview委托方法吗?如果tableview的滚动速度慢,这通常是由于委托方法造成的。我将发布这些方法,但正如我所提到的,只有在使用RestKit下载数据时,在完成tableview后,它才能流畅地工作。