iphone - xcode 在模拟器和设备上安装速度很慢

标签 iphone xcode gcc ios-simulator

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

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

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

构建本身阶段大约需要 2 秒,因此问题在于安装。

有人有任何加快速度的技巧吗?图像不需要改变,那么是否可以告诉xcode不要每次都复制图像?还是有其他因素会减慢速度?

谢谢

最佳答案

我的解决方案是在我的 Mac 上设置一个 zip 文件,然后让 iPhone 应用程序检测资源是否已下载,如果没有,则从 Mac 中获取它们并解压缩。然后应用程序很精简,可以下载它需要的内容。这仅用于调试目的,最后,您希望安装所有 Assets ,因此人们在安装后不必下载。相关代码看起来像这样(没有错误检查,您可能需要调整路径)。我一直在使用优秀的ASIHTTP library ,以及 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 ( @"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];
  }

关于iphone - xcode 在模拟器和设备上安装速度很慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3084557/

相关文章:

c - GCC 输出空的汇编文件

iphone - NSNotificationCenter 与委派(使用协议(protocol))?

iphone - 如何判断何时删除 subview UIView

ruby - 无法设置 ruby​​ 环境 - 安装 fii gem 错误

涉及Glib2库的C程序编译问题?

c - 替换裸机嵌入式系统中的启动文件

ios - 未找到 iOS 设备,是否已插入?在 ideviceinstaller/ideviceinfo

iphone - 计算 float 的问题

xcode - macOS 想要进行更改。输入管理员的名称和密码以允许此操作

objective-c - 如何将 NSLog 的输出绑定(bind)(重定向?)到 IBOutlet 等?