---
title: "用 lipo 命令裁剪出需要的 architecture"
author: "简单的茶"
date: "2013-11-06T15:23:08Z"
tags: []
categories: ["移动开发"]
slug: "lipo-architecture"
draft: false
lastmod: "2013-11-06T15:23:08Z"
id: 1972096
url: "https://lisai.iteye.com/blog/1972096"
---

iOS 上的 framework 和 .a 库一般会同时支持多个 architecture, 比如 i386, armv7, armv7s 等。
    为了减小程序的尺寸，可能需要裁剪掉不需要的 architecture, 这时就需要使用 lipo 命令给程序瘦身。
     Step1: 查看目标库文件支持的 architecture, 两个选择
                1.1 lipo -info 目标库文件
                 1.2 file 目标库文件
    Step2: 生成只支持一个 architecture 的 库文件
                 lipo 目标库文件 -thin 目标architecture 目标文件名
                 eg:    lipo MVC -thin i386 MVC.i386
                 eg1:    lipo MVC -thin armv7 MVC.armv7

       最后，删掉旧的库文件，把目标库文件改成原来的名字，进行替换即可。

     YEAH！