Missing required icon files in build from Xcode 9

夙愿已清 提交于 2019-12-20 10:27:09

问题


Using Xcode 9 and Application Loader:

But as you can see there are all required icons:

What is the case?

This is my podfile:

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!

and it doesnt work at all;(

EDIT:

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

回答1:


Make sure Copy Bundle Resources is under [CP] Embed Pods Frameworks and [CP] Copy Pods Resources in Build Phases.




回答2:


I have the same problem. Check this: solution

Just add this code below to your podfile:

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

and then run in console pod install

EDIT:

If its not working, locate your app's xcarchive file, right click >> show package contents, navigate to products >> applications >> your application's name >> show package contents. Locate the info plist from here, and change the BuildMachineOsBuild to 16A323. This basically tricks the computer into thinking it's on an older OS.. problem seems to stem from High Sierra. Then submit the app.




回答3:


After trying some of the suggestions above which removed some errors, in my case I could solve all of them by renaming the AppIcon in the project's .xcassets file. The project uses CocoaPods and some of these pods contain example projects with AppIcon in it as well. So instead of removing these I simply renamed my AppIcon and changed the reference in project settings. From that moment on, it finally processed after hours of trial and error.

When looking in the Pods xcassets files with Xcode they were missing the marketing icon and the iPad Pro icon definition (older libraries). These were the exact errors I got. In the archive the files are now named AppIcon and so are they referenced in Info.plist file.

PS: to find out if you have multiple AppIcon assets, you can use find . -name AppIcon*




回答4:


  • Archive project as usual
  • On latest build in organizer from context menu pick 'Reveal in finder'
  • On archive file in finder from context menu pick 'Show package contents'
  • Open terminal and CD to this folder
  • Run this command in terminal:

find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323

Then proceed with regular upload. At the end you'll see a warning popup about missing marketing icon but build will go through




回答5:


I had same issue. Fixed by removing CFBundleIcons~ipad key from info.plist

Check here




回答6:


In my case one of Pods has .xcassets with resources. Errors with icons gone after excluding this pod. Finally pod was fixed by replacing .xcassets with .bundle.

Part of .podspec change log:

-  s.resources = '**/*.xcassets'
+  s.resources = '**/*.bundle'



回答7:


As @Daniel Kuta said the solution is:

  1. locate your app's xcarchive file,
  2. show package contents >> products >> applications >> your application's name >> show package contents.
  3. Locate the info plist from here, and change the BuildMachineOsBuild to 16A323.

However above solution will remove first three errors, but not the last one warning.




回答8:


Please move AppIcon to default Assets.xcassets instead Icon.xcassets.

Also here are some tips... https://developer.apple.com/library/content/qa/qa1686/_index.html

I suggest to keep old icon names even if apple says that it isn't mandatory.



来源:https://stackoverflow.com/questions/46462871/missing-required-icon-files-in-build-from-xcode-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!