AppIcon is not displayed in SpringBoard when linking with frameworks including assets

Originator:fabien.lydoire
Number:rdar://34303722 Date Originated:September 7 2017
Status:Open Resolved:
Product:Xcode Product Version:Xcode 9.0 beta 6 (9M214v)
Classification: Reproducible:Always
 
Area:
Xcode

Summary:
When using cocoapods and linking with pod 'NearbyMessages', the AppIcon is not displayed in the SpringBoard

Steps to Reproduce:
1. Create a project using Xcode 9.0 beta 6 (9M214v).
2. Add assets to the Assets.xcassets assets library
3. Launch the App -> Icon is displayed in the SpringBoard
4. Init cocoapods for this project ($pod init)
5. Edit the created podfile to
          platform :ios, '11.0'
          target 'AppIcon' do
            use_frameworks!
            pod 'NearbyMessages'
          end
6. $pod install
7. Open the created workspace and launch the app -> Icon is not displayed in the SpringBoard

Expected Results:
It did work using Xcode 8. App Icon should be displayed when building with Xcode 9

Actual Results:
Icon is not displayed in the SpringBoard

Version/Build:
Xcode 9.0 beta 6 (9M214v).

Comments

Thanks dwebb, it fixes the issue. Nice workaround.

By fabien.lydoire at Oct. 17, 2017, 9:18 a.m. (reply...)

Known bug in Cocoapods; here's a workaround

I've reproduced the problem you're seeing. It's apparently a known bug in Cocoapods. A workaround is given by a developer in this discussion: https://github.com/CocoaPods/CocoaPods/issues/7003#issuecomment-329677763

The workaround is to add the following code to the bottom of 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

(Sorry for the formatting; I don't know why the line breaks have been removed.)

I tried it on my project, and it worked! Let me know if you need help.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!