欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

iOS11上Xcode9 AppIcon 图标不显示

程序员文章站 2023-12-19 22:20:40
实例一: 打开工程目录下:[工程名]/pods/target support files/pods-[工程名]/pods-[工程名]-resources.sh这个文件,替...

实例一:

打开工程目录下:[工程名]/pods/target support files/pods-[工程名]/pods-[工程名]-resources.sh这个文件,替换最后一段代码:

修改前:

printf "%s\0" "${xcasset_files[@]}" | xargs -0 xcrun actool --output-format human-readable-text 
--notices 
--warnings --platform "${platform_name}" 
--minimum-deployment-target "${!deployment_target_setting_name}" ${target_device_args} 
--compress-pngs --compile "${built_products_dir}/${unlocalized_resources_folder_path}"
fi

修改后:

printf "%s\0" "${xcasset_files[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${platform_name}" --minimum-deployment-target "${!deployment_target_setting_name}" ${target_device_args} --compress-pngs --compile "${built_products_dir}/${unlocalized_resources_folder_path}" --app-icon "${assetcatalog_compiler_appicon_name}" --output-partial-info-plist "${build_dir}/assetcatalog_generated_info.plist"
fi

然后重新运行工程即可

实例二:

在xcode9下新建一个工程看一下, 设置图标是显示的, 但是假如cocoapod就不显示了. 多方查询发现
图标不显示主要是cocoapod出现了问题, 需要在podfile文件加入以下脚本 [标红的地方]

1.加入脚本

platform :ios, '8.0'

target ‘lqz' do
  pod 'mjrefresh'
  pod 'afnetworking'
  
post_install do |installer|
  copy_pods_resources_path = "pods/target support files/pods-[工程名]/pods-[工程名]-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

上一篇:

下一篇: