Main app assets catalog copied in today extension

When I added a Today Extension my app suddenly gained a lot of weight... so I did a rapid checkup to see where that fat is coming from. It look like the .apex is 13MB, the 'Assets.car' file is the even bigger than the one in my main app (+8MB). The thing is, I use only 1 image in the assets catalog I have in my extension.

I checked within Xcode, my main app assets catalog is not toggled to be copied with the extension, but it sounds like it is in fact.

Is it normal? Do you know what to do in order to reduce the final .apex size?

Thanks!


Are you by any chance using Cocoapods?

There's currently an open issue that causes the Copy Pods Resources run script to locate all assets and compile them into a big archive, which might not be desired for all targets.

Until this is fixed, a simple solution is to add a post_install hook to your Podfile :

# Fix broken copy-resources phase per https://github.com/CocoaPods/CocoaPods/issues/1546.
post_install do |installer|
  installer.project.targets.each do |target|
    scriptBaseName = ""Pods/Target Support Files/#{target.name}/#{target.name}-resources""
    sh = (<<-EOT)
      if [ -f #{scriptBaseName}.sh ]; then
        if [ ! -f #{scriptBaseName}.sh.bak ]; then
          cp #{scriptBaseName}.sh #{scriptBaseName}.sh.bak;
        fi;
        sed '/WRAPPER_EXTENSION/,/fin/d' #{scriptBaseName}.sh > #{scriptBaseName}.sh.temp;
        sed '/*.xcassets)/,/;;/d' #{scriptBaseName}.sh.temp > #{scriptBaseName}.sh;
        rm #{scriptBaseName}.sh.temp;
      fi;
    EOT
    `#{sh}`
  end
end

Credit for the above code snippet goes to all the helpful people in the issue thread!

链接地址: http://www.djcxy.com/p/22946.html

上一篇: 如何在程序集中的结构指针上定义一个函数?

下一篇: 主要应用程序资产目录复制在今天的扩展