当前位置: 移动技术网 > 移动技术>移动开发>IOS > iOS11上Xcode9 AppIcon 图标不显示

iOS11上Xcode9 AppIcon 图标不显示

2019年07月24日  | 移动技术网移动技术  | 我要评论

实例一:

打开工程目录下:[工程名]/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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网