代码之家  ›  专栏  ›  技术社区  ›  Bartłomiej Semańczyk

从Xcode 9生成的版本中缺少必需的图标文件

  •  19
  • Bartłomiej Semańczyk  · 技术社区  · 8 年前

    使用Xcode 9和应用程序加载器:

    enter image description here

    但正如您所见,有所有必需的图标:

    enter image description here

    这是我的播客文件:

    use_frameworks!
    source 'https://github.com/CocoaPods/Specs.git'
    
    def pods
    
        pod 'GoogleMaps'
        pod 'PickerView'
        pod 'SWNavigationController'
        pod 'Branch'
        pod 'JTAppleCalendar', :git => 'https://github.com/patchthecode/JTAppleCalendar.git', :branch => 'master'
        pod 'SVProgressHUD'
    end
    
    def universal_pods
    
        pod 'AFNetworking'
        pod 'Crashlytics'
        pod 'Fabric'
        pod 'MagicalRecord'
    end
    
    target 'FieldService' do
    
        pods
        universal_pods
    end
    
    target 'FieldServiceTests' do
    
        pods
        universal_pods
    end
    
    target 'FieldServiceTodayTimer' do
        universal_pods
    end
    
    target 'FieldServiceTodayCurrent' do
        universal_pods
    end
    
    post_install do |installer|
        copy_pods_resources_path = "Pods/Target Support Files/Pods-FieldService/Pods-FieldService-resources.sh"
        string_to_replace = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"'
        assets_compile_with_app_icon_arguments = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${BUILD_DIR}/assetcatalog_generated_info.plist"'
        text = File.read(copy_pods_resources_path)
        new_contents = text.gsub(string_to_replace, assets_compile_with_app_icon_arguments)
        File.open(copy_pods_resources_path, "w") {|file| file.puts new_contents }
    end
    
    inhibit_all_warnings!
    

    它根本不起作用;(

    enter image description here enter image description here

    Contents.json:              ASCII text
    Icon-60.png:                PNG image data, 60 x 60, 8-bit/color RGBA, non-interlaced
    Icon-60@2x.png:             PNG image data, 120 x 120, 8-bit/color RGBA, non-interlaced
    Icon-60@3x.png:             PNG image data, 180 x 180, 8-bit/color RGBA, non-interlaced
    Icon-76.png:                PNG image data, 76 x 76, 8-bit/color RGBA, non-interlaced
    Icon-76@2x.png:             PNG image data, 152 x 152, 8-bit/color RGBA, non-interlaced
    Icon-Small.png:             PNG image data, 29 x 29, 8-bit/color RGBA, non-interlaced
    Icon-Small@2x-1.png:        PNG image data, 58 x 58, 8-bit/color RGBA, non-interlaced
    Icon-Small@2x.png:          PNG image data, 58 x 58, 8-bit/color RGBA, non-interlaced
    Icon-Small@3x.png:          PNG image data, 87 x 87, 8-bit/color RGBA, non-interlaced
    Icon-Spotlight-40.png:      PNG image data, 40 x 40, 8-bit/color RGBA, non-interlaced
    Icon-Spotlight-40@2x-1.png: PNG image data, 80 x 80, 8-bit/color RGBA, non-interlaced
    Icon-Spotlight-40@2x.png:   PNG image data, 80 x 80, 8-bit/color RGBA, non-interlaced
    Icon-Spotlight-40@3x.png:   PNG image data, 120 x 120, 8-bit/color RGBA, non-interlaced
    Icon-Spotlight-41.png:      PNG image data, 40 x 40, 8-bit/color RGBA, non-interlaced
    Icon-Spotlight-42.png:      PNG image data, 40 x 40, 8-bit/color RGBA, non-interlaced
    Icon-Spotlight-43.png:      PNG image data, 20 x 20, 8-bit/color RGBA, non-interlaced
    Icon-iPadPro@2x.png:        PNG image data, 167 x 167, 8-bit/color RGBA, non-interlaced
    fieldservice.png:           PNG image data, 1024 x 1024, 8-bit/color RGBA, non-interlaced
    
    8 回复  |  直到 8 年前
        1
  •  6
  •   tommybananas    8 年前

    Copy Bundle Resources 在下面 [CP] Embed Pods Frameworks [CP] Copy Pods Resources 在构建阶段。

    enter image description here

        2
  •  5
  •   Daniel Kuta    8 年前

    我也有同样的问题。检查此项: solution

    post_install do |installer|
          installer.aggregate_targets.each do |target|
            copy_pods_resources_path = "Pods/Target Support Files/#{target.name}/#{target.name}-resources.sh"
            string_to_replace = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"'
            assets_compile_with_app_icon_arguments = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${BUILD_DIR}/assetcatalog_generated_info.plist"'
            text = File.read(copy_pods_resources_path)
            new_contents = text.gsub(string_to_replace, assets_compile_with_app_icon_arguments)
            File.open(copy_pods_resources_path, "w") {|file| file.puts new_contents }
          end
        end
    

    然后在控制台中运行 pod install

    编辑:

        3
  •  4
  •   Jos van Velzen    8 年前

    在尝试了上面的一些建议并删除了一些错误之后,在我的例子中,我可以通过重命名项目中的AppIcon来解决所有问题。xcassets文件。该项目使用CoCoaPod,其中一些Pod还包含带有AppIcon的示例项目。因此,我没有删除这些,只是重命名了AppIcon并更改了项目设置中的引用。从那一刻起,经过数小时的反复试验,它最终得以处理。

    find . -name AppIcon*

        4
  •  2
  •   Aleksey Mazurenko    8 年前
    • 从上下文菜单中选择“在查找器中显示”的最新内置管理器
    • 在查找器中的存档文件上,从上下文菜单中选择“显示包内容”
    • 打开终端和CD到此文件夹

    查找产品/名称信息。plist-print0 | xargs-0n1 plutil-替换BuildMachineOSBuild-string 16A323

        5
  •  2
  •   user1901407    8 年前

    我也有同样的问题。 通过移除固定 CFBundleIcons~ipad 信息中的键。plist公司

    Check here

        6
  •  1
  •   Michael Yudin    8 年前

    .XC资产 具有 .捆 .

    -  s.resources = '**/*.xcassets'
    +  s.resources = '**/*.bundle'
    
        7
  •  0
  •   Bartłomiej Semańczyk    8 年前

    正如Daniel Kuta所说,解决方案是:

    1. 找到应用程序的xcarchive文件,
    2. 显示包装内容(&T)&燃气轮机;产品>&燃气轮机;应用程序>&燃气轮机;您的应用程序名称>&燃气轮机;显示包内容。
    3. 从这里找到信息列表,并更改 16A323 .

        8
  •  0
  •   Tomasz Czyżak    8 年前

    请将AppIcon移动到默认资产。xcassets图标。XC资产。

    这里还有一些提示。。。 https://developer.apple.com/library/content/qa/qa1686/_index.html

    我建议保留旧的图标名称,即使苹果说这不是强制性的。

    推荐文章