V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
guomiaoyou7784
V2EX  ›  iDev

安利一个小工具 用于分析 iOS 包大小

  •  
  •   guomiaoyou7784 · 2016-12-30 13:50:11 +08:00 · 4875 次点击
    这是一个创建于 2884 天前的主题,其中的信息可能已经有所发展或是发生改变。

    LinkMapAnalyzer

    基于项目工程编译链接产生的 Linkmap 文件,分析项目中各个模块的大小。

    使用时要确保项目的 Build Settings -> Write Link Map File 已置为YES。然后在Path to Link Map File表明的路径里找到自己工程生成的 LinkMap 文件

    如 LinkMap 文件内容大致为

    # Path: /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Products/Debug-iphonesimulator/GAG.app/GAG
    # Arch: x86_64
    # Object files:
    [  0] linker synthesized
    [  1] /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Intermediates/GAG.build/Debug-iphonesimulator/GAG.build/GAG.app.xcent
    [  2] /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Intermediates/GAG.build/Debug-iphonesimulator/GAG.build/Objects-normal/x86_64/GMYListItem.o
    [  3] /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Intermediates/GAG.build/Debug-iphonesimulator/GAG.
    ...
    <<dead>> 	0x00000007	[ 44] literal string: length
    <<dead>> 	0x00000006	[ 44] literal string: alloc
    <<dead>> 	0x00000008	[ 44] literal string: CGImage
    <<dead>> 	0x00000011	[ 44] literal string: imageOrientation
    <<dead>> 	0x00000023	[ 44] literal string: initWithCGImage:scale:orientation:
    <<dead>> 	0x00000018	[ 44] CIE
    
    

    LinkMapAnalyzer 分析结果各个模块大小为:

    # Path: /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Products/Debug-iphonesimulator/GAG.app/GAG
    # Arch: x86_64
    [debug]: 0-unknownFile-unknownModule
    [debug]: read file line count = 11811
    libAFNetworking.a                                                       314.20KB
    libSDWebImage.a                                                         194.45KB
    libMasonry.a                                                             94.99KB
    GAG                                                                      55.24KB
    libSVPullToRefresh.a                                                     43.88KB
    libarclite_iphonesimulator.a                                              7.43KB
    unknownModule                                                             2.04KB
    libPods-GAG.a                                                             0.25KB
    
    
    
    [-] totalSize : 0.695766MB
    [-] Cast Time : 8
    
    
    4 条回复    2017-03-02 10:57:58 +08:00
    lynulzy
        1
    lynulzy  
       2016-12-30 15:01:03 +08:00
    很方便
    guomiaoyou7784
        2
    guomiaoyou7784  
    OP
       2016-12-30 16:14:37 +08:00
    @lynulzy 谢谢支持。
    XuYanci
        3
    XuYanci  
       2017-03-02 08:22:38 +08:00 via iPhone
    能够分析不止是静态 目标文件等大小就更棒了
    guomiaoyou7784
        4
    guomiaoyou7784  
    OP
       2017-03-02 10:57:58 +08:00
    @XuYanci 可以讲讲你的具体需求吗?或者在 github 上给我提 issue ,我会抽空解决的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2557 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 04:57 · PVG 12:57 · LAX 20:57 · JFK 23:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.