简体   繁体   English

使用cocoapods在iOS 11中出现图标问题

[英]Issue with icons in iOS 11 using cocoapods

Scenario: 场景:

  • Xcode 9 and iOS 11 SDK. Xcode 9和iOS 11 SDK。
  • Cocoapods version 1.3.1 Cocoapods版本1.3.1
  • Project with multiple targets 有多个目标的项目

When I run my app on simulator or device with iOS 11 the app icon seams like unset, but of course it was setted in Assets.xcassets -> AppIcon.appiconset and works perfectly in iOS<=10.3.3. 当我在装有iOS 11的模拟器或设备上运行我的应用程序时,该应用程序图标的接缝像未设置一样,但当然是在Assets.xcassets-> AppIcon.appiconset中设置的,并且可以在iOS <= 10.3.3中完美地工作。

这是结果

Can someone help me with this issue? 有人可以帮我解决这个问题吗? Thanks. 谢谢。

They added one more app icon size in new XCode, try to add that resolution and then check it out. 他们在新的XCode中又增加了一个应用图标大小,尝试添加该分辨率,然后将其签出。 I think it is 1024*1024. 我认为是1024 * 1024。

I was faced the same issue in my Project ... I have tried so many ways to solve it .... Finally I solved it for me like this ---- 我在我的项目中也遇到了同样的问题……我尝试了多种解决方法……。最后我像这样为我解决了----

I remove all the iCon from Assets.xcassets -> AppIcon.appiconset After that from X-code menu bar selecte Product-->Clean And delete the app from Simulator .. 我从Assets.xcassets -> AppIcon.appiconset remove所有iCon之后,从X-code menu bar选择Assets.xcassets -> AppIcon.appiconset Product-->Clean并从Simulator delete该应用程序。

Again add the all the iCon in Assets.xcassets -> AppIcon.appiconset Run it ,,, and iCon is showing on the screen ... May it will help you. 再次在Assets.xcassets -> AppIcon.appiconset添加所有iCon。运行它,然后iCon将显示在屏幕上……可能会为您提供帮助。

SOLUTION Add this script at bottom of podfile: 解决方案:将此脚本添加到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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM