xcode在模拟器和设备上安装速度慢 [英] xcode slow to install on simulator and device

查看:222
本文介绍了xcode在模拟器和设备上安装速度慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在模拟器上构建并运行大约需要30秒



在设备上构建并运行大约需要5分钟。 b
$ b

我99%确定原因是我有很多图像(〜4000〜80mb)。

大约需要2秒钟,所以问题在于安装。



有人有任何提示可以加速吗?图像不需要改变,所以有可能告诉xcode不要每次都复制图像?或者其他的东西可以放慢速度?



谢谢 我的解决方案是在我的Mac上设置一个zip文件,然后让iPhone应用程序检测是否下载了资产,如果没有,请从Mac中抓取并解压。然后,该应用程序很苗条,并下载它所需要的。这仅用于调试目的,最后,您希望安装所有资产,以便人们在安装后不必下载。相关的代码看起来像这样(没有错误检查,你可能需要调整路径)。我一直在使用优秀的ASIHTTP 图书馆,以及 ZIPArchive 项目。您需要更改您的下载URL。

 
BOOL isDirectory;
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:installDirectory isDirectory:&isDirectory];
NSLog(@Checking for file:%@,installDirectory);
if(!fileExists){
NSString * path = [docsPath stringByAppendingString:@foo.zip];
NSLog(@下载文件!);
NSURL * url = [NSURL URLWithString:@http://10.0.0.11/~blezek/foo.zip];
ASIHTTPRequest * request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadDestinationPath:path];
[request startSynchronous];

//现在解压缩
ZipArchive * zipper = [[[ZipArchive alloc] init] autorelease];
[zipper UnzipOpenFile:path];
[zipper UnzipFileTo:docsPath overWrite:NO];

NSFileManager * fileManager = [NSFileManager defaultManager];
[fileManager removeItemAtPath:path error:NULL];
}


To 'build and go' on the simulator takes about 30 seconds

To 'build and go' on the device takes about 5 mins.

I am 99% sure the reason is that I have lot of images (~4000 ~80mb).

The build itself stage takes about 2 seconds, so the problem is the install.

Does anyone have any tips to speed it up? The images do not need to be changed, so is it possible to tell xcode not to copy the images each time? Or could something else be slowing it down?

Thanks

解决方案

My solution for this was to setup a zip file on my Mac, then have the iPhone app detect if the assets were downloaded, if not, grab them from the Mac and unzip. Then the app is slim, and downloads what it needs. This is only for debugging purposes, in the end, you would like to have all the assets installed, so people don't have to download after they've installed. The relevant code looks something like this (no error checking, and you may need to adjust the paths). I've been using the excellent ASIHTTP library, and the ZIPArchive project. You'll need to change your download URL.

  BOOL isDirectory;
  BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:installDirectory  isDirectory:&isDirectory];
  NSLog ( @"Checking for file: %@", installDirectory );
  if ( !fileExists ) {
    NSString* path = [docsPath stringByAppendingString:@"foo.zip"];
    NSLog ( @"Download file!" );
      NSURL *url = [NSURL URLWithString:@"http://10.0.0.11/~blezek/foo.zip"];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDownloadDestinationPath:path];    
    [request startSynchronous];

    // Now unzip
    ZipArchive *zipper = [[[ZipArchive alloc] init] autorelease];
    [zipper UnzipOpenFile:path];
    [zipper UnzipFileTo:docsPath overWrite:NO];

    NSFileManager *fileManager = [NSFileManager defaultManager];
    [fileManager removeItemAtPath:path error:NULL];
  }

这篇关于xcode在模拟器和设备上安装速度慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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