Run project on device from Xcode 9 Beta 6
Install on device and show included app icon
Installed on device but app icon was the default as if you had not set any app icons
Note:
If project is run from Xcode 8.3.3 the correct app icon is visible.
If project is run without CocoaPods the correct app icon is visible.
CocoaPods : 1.3.1
Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
RubyGems : 2.0.14.1
Host : Mac OS X 10.12.6 (16G29)
Xcode : 8.3.3 (8E3004b)
Git : git version 2.11.0 (Apple Git-81)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 349acd3cdb79892c96f2a0dcba3e187244680d3f
Executable Path: /usr/local/bin/pod
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.2.0
cocoapods-try : 1.1.0
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'IconTest' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for IconTest
pod "DBCamera"
end
I have the same problem, a little research has shown a possible problem:
At first xcode compiles assets in the "Copy Bundle Resources" build step using --app-icon argument.
After that, in step "[CP] Copy Pods Resources" Pods-your_project_name-resources.sh compiles assets from dependencies without --app-icon argument and overwrites Assets.car
Fix: Add --app-icon argument to the assets compilation command in Pods-your_project_name-resources.sh with the appropriate catalog and plist file.
Adding this code to the Podfile should help:
post_install do |installer|
copy_pods_resources_path = "Pods/Target Support Files/Pods-IconTest/Pods-IconTest-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
Same issue here. Just use the temp solution above. I think it's issue related to Copy Pods Resources
in cocoapods because after I remove that build phase, the Application Icon is OK. I want to find the actual issue but i'm not familiar with shell script. Hope for an official solution. 😕
@khomTima Any way to make that generic to every Pods-*
value that's generated? In a project with 12 results there, it's a bit awkward.
@khomTima I tried your solution, but app icon set as Afnetworking (I use Afnetworking) icon, not worked for my project
@jshier just loop over all the targets
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
@khomTima any idea on why it doesn't work for @oguzgu ?
I found the solution, i also using carthage and afnetworking has an example project in checkout folder. I removed example project and it worked
@powerqian Thanks, that worked! I just didn't know what thing to iterate to get the values that were needed. There are Ruby docs available for this stuff, but little that explains what things are actually for.
_Update later:_ Turned out after much experimenting, my issue was not with Cooapods whatsover. Rather, something seems to have changed in Xcode 9 which meant that pngs that were previously rendered fine as an AppIcon were no longer working. Replacing the images with new pngs, at the same resolutions, that had been created with a different process, resolved my issues. See Stack Overflow discussion.
_Original comments:_ Not sure how helpful this is to post so hesitated, but just to note that I've tried the solution posted above and it hasn't resolved the issue with one of my projects—it still is building without the app icon appearing.
Inspecting the build intermediates and products directories, I can see that the AppIcon resources are included in the .app bundle, and that the AppIcon resources are listed in the assetcatalog_generated_info.plist, yet inspecting the Assets.car with cartool shows that there is an AppIcon entry but there are no image resources are listed under it. Not sure why or exactly where the process is failing.
I've added the above to post_install
, but am still receiving rejections from Apple :/.
If I comment out the Copy Pods Resources Phase the upload works. But I have other problems as it's obviously missing some resources. fwiw
Note, make sure you're on cocoapods v1.3.1. That was my issue above.
https://github.com/CocoaPods/CocoaPods/issues/7003#issuecomment-329591422
The answer regarding Carthage above has put me in the right direction.
I have a Carthage checkouts folder with RxSwift. Inside the checkout there's a RxExample app - this folder also contains an assets bundle file called Images.xcassets
with RxSwift app icons inside it.
My own bundle has a Images.xcassets
assets bundle and when building the RxSwift Images.xcassets
overwrites my own Images.xcassets
. I have no idea why but my current work around is to remove the RxExample folder from the checkout directory and everything works but this is not ideal when building using our CI server since we always bootstrap and build from Carthage sources.
I am actually finding the above solution does not work. It appeared to work once yesterday, but the last 8 hours have made me conclude it's not a proper solution. I am able to successfully validate the Archive only if I comment out the Copy Pods Resources phase :/
I tried the workaround above with no luck. I've also tried exporting all my icons again, as @babbage recommended, but the iTunes Connect errors persist. There are several people reporting this on the Apple Developer Forums as well.
@matmartinez I discovered my issue was because I was on what I thought to be the High Sierra GM. As of writing this the only High Sierra build available is a "GM Candidate." I don't think they green lighted it yet. Changing the build information in your archive to spoof Sierra fixed the issue for me.
Outlined here.
https://forums.developer.apple.com/thread/86290
First of all make sure that you’re on the latest version of Sierra and than archive your app as usually. Once your app was archived right click it and choose show in Finder. Open the package contents and open this file inside of it: /Products/Application/yourApp.app/info.plist
In there you have to change all the DTXXX Values to be the same as in the latest version of Xcode 8.
DTXcode - “0833”
DTSDKName - “iphoneos10.3"
DTSDKBuild - “14E8301”
DTPlatformName - “iphoneos”
DTCompiler - “com.apple.compilers.llvm.clang.1_0”
DTXcodeBuild - “8E3004b”
DTPlatformVersion - “10.3”
DTPlatformBuild - “14E8301"
@brandons thanks for the help! Does your app behave as it was linked against iOS 11? I tried changing just the BuildMachineOSBuild
key, but it doesn't have any effect.
@matmartinez Yes, we are compiled against iOS 11. For me, changing to the values above allowed me to submit. I think it only has an affect on transmitting it to iTC. Our build processed fine with TestFlight and is awaiting App Store review.
My solution was different. Had to comment out one of the install_resource
lines in Pods-NAME-resources.sh
file. It was a pod called Ambassador
. After commenting out that single line everything uploaded fine. Fortunately, we did not need the resources it provides, but that could be an issue for someone else...
fwiw, The line commented out, for each configuration:
#install_resource "${PODS_ROOT}/Ambassador/Ambassador.bundle"
I just moved the "Copy Bundle Resources" to the last step in the Build Phases, and the app icon showed up in iOS11 devices.
Ok here's my theory after spending a whole day investigating this.
For some reason, the "copy pod resources" build phase script is recursively looking through the project root folder and then running actool's processing steps on it. During this recursive look it happens to find xcassets
that may or may not be included in the project (i.e. my Carthage checkouts folder is one example) and these get copied into the app bundle.
What's changed in Xcode 9 is that inside the app bundle, the actual icons seem to live outside the compiled Assets.car file regardless of whether you used an asset catalog or not.
So when building the IPA, every time Xcode's build tool finds a matching icon name inside a an xcassets file (i.e. AppIcon
) it will extract and copy it to the app bundle root folder, which may result in overwriting the correct one.
For those of you seeing no icon (instead of the wrong icon), can you do a recursive search on your project folder to see if you can find any Pods or libraries that include xcassets, and if any of these contains an icon file that matches your own icon name (i.e. AppIcon).
Here's a sample of what the copy resources script finds when searching for xcassets inside my project. Note that the Carthage checkout folder is NOT part of the project itself, it just happens to live inside the project folder.
/Users/[username]/app/Carthage/Checkouts/RxSwift/RxExample/RxExample/Images.xcassets
/Users/[username]/app//Pods/Kite-Print-SDK/Kite-SDK/PSPrintSDK/KitePrintSDK.xcassets
/Users/[username]/app/Resources/Images.xcassets
@rpassis interesting thoughts. Certainly some funky stuff going on. I set the script to set -x
to see what was happening and noticed it never entered the below loop, for us. Which then led me to the install_resource
lines. I do see an Assets.car file in the culprit's bundle, but there is no AppIcon
or name conflicting file that I can see. Hope this stuff helps others out there!
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
then
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
while read line; do
if [[ $line != "${PODS_ROOT}*" ]]; then
XCASSET_FILES+=("$line")
fi
done <<<"$OTHER_XCASSETS"
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"
else
echo "NOT USING ACTOOL LOOP"
fi
It was a High Sierra issue for me. I managed to work around this by running below over the .xcarchive before submitting.
find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323
@rpassis You are the hero!
It was caused by High Sierra GM here. I could upload after doing @brandons steps. It complained tho. Once said App Store 1024px icon was missing and once said it had alpha channel, while it hadn't. But the build has processed and I could submit it.
For me, after review any workaround listed unsuccessfully, just created a new icon assets including PNG and Display P3 versions, and that fixed the issue. Just in case this other approach help anyone.
I'm on High Sierra as well. My app also has Apple Watch extension and none of the above worked for me :(
A further post in the non-Cocoapods-but-issue-related thread on StackOverflow is pointing the finger at the png colour space for some users, for App Icons that previously worked but now do not, so this is another thing to check if you're still having issues...
Thanks @babbage - i checked and some of my icons do have an alpha channel. Will re-export and try again.
Well, I re-worked all my icons to not have alpha channel. Still have the same problem submitting build with complaints about missing icons.
High Sierra is out today, can someone try submitting on final release?
@meyumeapps can you try something for me please?
Go to terminal and in your project folder run:
find . -name [YOUR_ICON_NAME]*
Replacing [YOUR_ICON_NAME]* with your icon name ie AppIcon*
.
Please paste the results here.
Will do. Just installing High Sierra GM ...
Sent from my iPhone
On Sep 25, 2017, at 9:45 PM, Rogerio de Paula Assis notifications@github.com wrote:
@meyumeapps can you try something for me please?
Go to terminal and in your project folder run:
find . -name [YOUR_ICON_NAME]*
Replacing [YOUR_ICON_NAME]* with your icon name ie AppIcon*.
Please paste the results here.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Ok, GM of High Sierra hasn't fixed anything.
In my project folder ... I have:
./WeatherGodsWatch/Assets.xcassets/AppIcon.appiconset
./WeatherGods/Assets.xcassets/AppIcon-2.appiconset
Here's the output from Application Loader, my colleague who is on El Capitan can build the same project and upload to TestFlight without issue.
Package Summary:
1 package(s) were not uploaded because they had problems:
/var/folders/bp/g738d4cj1gz5ylzqcnkdpcfw0000gn/T/E7672404-29E5-42F2-94CC-16A948A7DE2E/1041512978.itmsp - Error Messages:
ERROR ITMS-90022: "Missing required icon file. The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .png format for iOS versions >= 10.0."
ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '167x167' pixels, in .png format for iOS versions supporting iPad Pro."
ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '152x152' pixels, in .png format for iOS versions >= 10.0."
ERROR ITMS-90394: "Missing Icon. The watch application 'WeatherGods.app/Watch/WeatherGodsWatch.app' is missing icon with name pattern '*[email protected]' (Home Screen 38mm). Please visit https://developer.apple.com/watchkit/ for more information."
ERROR ITMS-90391: "Missing Icons. No icons found for watch application 'WeatherGods.app/Watch/WeatherGodsWatch.app'. Make sure that its Info.plist file includes entries for CFBundleIconFiles."
Just as a test, are you able to change the name of the AppIcon-2 to AppIcon and try resubmit?
Yep, will give it a try.
@rpassis sorry, same errors. Got to turn in now, will check tomorrow in case anyone else has progress. Cheers 👍
@meyumeapps I tried with @brandons solution and it works on Xcode 9 GM.
However, after updating to the App Store version (published on Sep 19, 2017), the bug is fixed! Try it if you haven't update to the App Store Version.
Are we converging here that perhaps cocoapods is not the issue? It seems I am reading mulitple reports of people saying things are fixed by updating app store or GM high sierra.
Either way this PR still needs to address the input/output path issue before it gets merged.
@benck @dnkoutso hi guys, not for me sadly, it was the app store version i installed yesterday and re-submitted. Same errors as before.
@benck , ah, do you mean the app store version of Xcode 9?
@MetoScott Yes the Xcode 9 on App Store(released on Sep 19).
I was having trouble uploading using Xcode 9 GM version also, but the new Xcode works fine when I was still on High Sierra beta 9 (released on Sep 1) two days ago.
The culprit file, for us, has been another Assets.car
file in a resource bundle. If I delete just that file in the bundle and leave everything else as-is, I can submit. Note, this is in reference to the generated install_resource
line in the Pods-NAME-resources.sh
file. So there's some issue in the copying.
@benck I have this problem and I'm using the App Store version of XCode 9.0 (9A235)
pod --version
1.4.0.beta.1
@benck nope, still the same problem with Xcode 9.0 (9A235)
here's my Assets.car
files, all as I would expect...
./Products/Applications/WeatherGods.app/PlugIns/Custom Stickers.appex/Assets.car
./Products/Applications/WeatherGods.app/PlugIns/Widget.appex/Assets.car
./Products/Applications/WeatherGods.app/Assets.car
./Products/Applications/WeatherGods.app/Watch/WeatherGodsWatch.app/PlugIns/WeatherGodsWatch Extension.appex/Assets.car
./Products/Applications/WeatherGods.app/Watch/WeatherGodsWatch.app/Assets.car
I think we are dealing with 2 different issues on this thread. I might start a separate one for those having issues with assets getting overwritten.
I think you may be right regarding "two issues".
There are a few things blocking the PR for issue from landing:
1) Input and output paths
2) It still appears there is no clear solution to this issue which makes me wonder if this is actually the right fix.
If you do file a new issue please include a sample app and clear reproducible steps. I can't stress enough how it helps us debug these issues.
I am personally not ignoring this one but so far I've seen multiple different error cases and various different solutions to merge this.
@dnkoutso can I try the cocoapods with this PR on my project? how?
Thanks
The only app I have this problem is an app where I have extensions. No workaround in the podifle works.
Same here.
I made a python script (it will require you to install biplist using PIP or otherwise) where you can point it at an Info.plist file or a directory (e.g. an xcarchive) where it will replace some values.
It's the spoofing solution suggested by @brandons above. I've successfully used this with our watch and imessage extensions as well.
Hoping to see a cocoapods or Xcode fix soon
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;(
I also have this problem.
My app has an apple watch app and lots of extensions.
It fails with the 120x120 icon error :(
I tried all the solutions but nothing seems to work.
@jonasman same here, I have watch, widget, stickers and notification extensions.
None of the solutions so far have worked. Getting very frustrated about the whole thing 😞
What is going on? Should I search issue in High Sierra, Xcode, Cocoapods or sth else?
I might have found a solution.
1) Make sure your images have no transparency with imagemagick:
identify -format '%[channels]' image.png
run to remove alpha: mogrify -alpha off image.png
2) Archive as normal
3) open the archive folder and copy the appstore icon if it is not there with the name: AppIcon1024x1024.png
(mine only existed on the apple watch app, not on the ios app)
4) run find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323
on your archive folder
5) Send to appstore
@meyumeapps try my solution and let me know if that worked for you.
@jonasman sorry, had already tried this last week, same results.
Tried a ton of stuff, nothing is working. It's really an issue with extension. It's the only app where it does that. Don't know what to do.
I ve asked a question on stackoverflow and started a bounty of 200 for the one who will help to solve that problem.
@kunass2 did you try my instructions?
@meyumeapps did try and it didn't help:)
@kunass2 Have you tried editing all the plist files contained in the .app directories for extensions and main application to ensure all values are spoofed?
find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323
The command above didn't replace all the things that need replacing for the plist - which is why I made the python script to find all the plist files inside an xcarchive and replace the values to look like macOS Sierra with Xcode 8.3.3. I found that combining replacing all the plist entries along with the resource script change above (thanks to @powerqian) resolved our issues.
@welshm i works but i am still getting a warning about missing marketing icon
@Saurman I do still get the warning but it seems to upload OK and looks fine on the app store from what I can tell so far
I had problem with missing iPad icons in iPhone only app.
I spent a lot of time and finally found the problem.
Fixed by removing CFBundleIcons~ipad
key from info.plist
Hope it will help somebody.
@brandons solution works for uploading App to iTC, but there is still blanc icon on any device with iOS 11 (version uploaded to TF)
Just an update to say that my last build was uploaded fine. I didn't change a thing so Apple must have finely fixed something 🎉
In my case one of Pods had .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'
Well, at last I have find a way to submit app to ITC with xcode9 and High Sierra:
This solution works for me, hope it can help
Just an update to say that my last build was uploaded fine. I didn't change a thing so Apple must have finely fixed something 🎉
This makes me even more uncertain about the open PR and to land this in 1.4.0.
AFAIK nothing here has converged into a simple reproducible case in which the PR open for this issue correctly fixes it.
Seems like there are several different issues in the thread.
I had an iPad only icon loss. @vzarubanov, thanks for the solution! Worked out for me.
After trying most suggestions above I renamed the AppIcon asset name in my project (and the reference to it in the project). I had several pods containing example projects with an AppIcon asset in it. See also https://stackoverflow.com/a/46799223/1300678
I personally tried many of these suggested fixes but none worked until someone pointed me to some warnings in xcode that said my icons weren't the exact dimensions they were supposed to be. Turns out adhering to the right dimensions worked (i.e. fit the 72pt slot with 72x72 png, etc).
This pertains to apps that won't necessarily hit apple store validation (we're enterprise) — hope that helps someone!
打开工程目录下:[工程名]/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
然后重新运行工程即可
After trying every option from above, to no avail, I checked the "_Asset Catalog App Icon Set Name_" in my _Build Settings_ in Xcode, and I noticed it was empty. So I simply set this to "AppIcon" (or whatever your app icon set is named in the asset catalog) and it worked immediately.
Please note, if you have your _Build Settings_ set to "Basic" or "Customized" this setting may not show up. As a result, set it to "_All_"
@the-scott-davis Setting the Icon Set Name in build settings made the icon show up (which is a big step forward).
But unfortunately does not really work for us, since we want to re-use the same build and distribute it with slightly different metadata (icons etc). The search continues...
Just to perhaps help those smarter than me in troubleshooting this one:
-When I tried to add a new icons png's to the icon set, it failed with the same error.
-I deleted the entire assets set, grabbed an assets set from a similar app, pasted it into the current bundle then it then worked fine!!! (So nothing wrong with Xcode or its settings).
I checked some icon files and played around to figure out what was wrong.
Turned out to be: When I saved the new icons as PNG files in Photoshop, I didn't do it properly.
I clicked on the existing filename to over-write (xxxx.png) and hit enter, without specifically setting the format to PNG in the drop-down box.
After I did this, happy days!
Maybe it helps someone in the slim chance they are doing the same.
In my case, assigning sRGB (instead of Adobe RGB) profile to AppIcons worked.
I had trouble with compiling Unit tests target in a "multi-project" workspace.
the workaround is to check for "UnitTestsTarget":
post_install do |installer|
installer.aggregate_targets.each do |target|
if target.name != "UnitTestsTarget" then
puts "adding app icons for #{target.name}"
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
end
Hello,
In my case none of the solution suggested above worked.
But I have found a tricky behaviour that make it works.
We were using the Server & Bots to auto-generate our binaries/archives, there we found that the icons were missings.
Today we have tried to generate our binaries/archives using the manual approach
, it means from Product
-> Archive
, and magically it works!! it include the images!!
So weird.... anyway I'm pretty sure that this is not an CocoaPods
issue, this is something else, either OSX
or Xcode
.
Thanks in advance!!
@fjtrujy This is exactly what I have discovered today. The server bot archive is missing icons, though the build log seems to show that icons were generated from the .xcassets and individual icons with proper names exist in the intermediate build files. However, the final .xcarchive and .ipa have no icons, and so icon validation fails.
However, if I go into the bot's checkout directory, open the workspace, and Product > Archive
, I get a perfect .xcarchive from the exact same code that created the bad archive. So, I might add a bot post-integration script that does the Archive manually via xcodebuild
(something I already do to build for enterprise distribution).
Being discussed lightly here: https://forums.developer.apple.com/thread/91752
I have the same error above, but something special for me.The resources.sh file in Pods has a command like this OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d). You must make sure your icon's xcassets is exist in this path($PWD).
I came across a very simple solution that somehow fixed this problem problem for my build.
1) renaming the AppIcon folder name from "AppIcon" to "AppIcon-1",
or, in Xcode's Images.xcassets folder, create an new AppIcon folder by opening the contextual menu > App Icons & Launch Images > New iOS App Icon,
2) Load the correctly sized images into the new folder (that is named other than "AppIcon"),
3) Rebuild.
@cocosribbons It doesn't work for me - Xcode 9.2 (9C40b) / High Sierra 10.13.2 (17C205)
I have investigate this issue for a few hours. For the moment I have realised this:
The problem happens when a pod has a resource of type .xcassets.
I don't see the line in the build log when the .xcassets from the pod are supposed to be copied, I can see other logs like the bundles.
In /Pod/Target Support Files/Pods/Pods-resources.sh I have commented all the lines that contain install_resource with xcassets files , removed the whole if there all the lines are commented.
Moved the .xcassets that I need from the pod folder to my project folder, I need them and you should too.
That's all right now. I guess there has to be some kind of bug when copying .xcassets from pods and then AppIcon.xcassets in iOS11, because this only happens to me with iOS11.
Just to chime in on this, I managed to solve this by going to Build Phases
, then moving [CP] Embed Pods Frameworks
and [CP] Copy Pods Resources
_before_ Copy Bundle Resources
.
This way my resources don't get lost/overwritten, and everything seems to still work as expected.
Seems like a duplicate bug gave me a good reproducible case https://github.com/CocoaPods/CocoaPods/issues/7511
Going to see if I can work on a fix for this one.
Marking this for 1.5.0 with https://github.com/CocoaPods/CocoaPods/pull/7526 as the fix.
Fix has been merged for 1.5.0.
Just upgraded to 1.5.0.beta.1 and my app icon is back. Thanks for the fix!
If you build xcarchive at Xcode Server
, it will help you.
https://forums.developer.apple.com/thread/91752
I'm on 1.5.0 and I still see this issue.
I have a project that uses mixed cocapods and carthage, and one of the carthage checkouts has a demo project which has an AppIcon folder. And that one gets overwritten over the app icon.
Don't think Carthage is to blame, cause it should work ok irrespective of what project structure one might have. The script should be made a bit more smart.
I am on CocoaPods 1.5.2 and I was having the following issues: ITMS-90022, ITMS-90023, ITMS-90704 when I tried to upload to the app store after archiving. I've tried pod deintegrate and pod install on xCode 9.2 (9C40b). I uninstalled 9.2 and installed xCode 9.1 (9B55). Ran pod deintegrate and pod install on the same project, archived and uploaded to the app store with no issues. I tried switching the png pictures with jpg but that didn't fix anything on 9.2, I uninstalled and re-installed 9.2 but still had issues.
I am running Sierra 10.12.6
I was able to get 9.1 from https://developer.apple.com/download/more/
I have the same problem, a little research has shown a possible problem:
At first xcode compiles assets in the "Copy Bundle Resources" build step using --app-icon argument.
After that, in step "[CP] Copy Pods Resources" Pods-your_project_name-resources.sh compiles assets from dependencies without --app-icon argument and overwrites Assets.car
Fix: Add --app-icon argument to the assets compilation command in Pods-your_project_name-resources.sh with the appropriate catalog and plist file.Adding this code to the Podfile should help:
post_install do |installer| copy_pods_resources_path = "Pods/Target Support Files/Pods-IconTest/Pods-IconTest-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
Works for me. In my case there was a resource in dependency has same name as the one in the main bundle which causes override problem.
pod: 1.5.3
Xcode: 10
Somehow archive
found other AppIcon files from other libraries and has overridden my AppIcons.
QuickFix: just renamed my AppIcon
to AppIconSomethingUnique
and selected it as App Icon Source in settings.
I tried the post_install script above to solve this problem, however after looking the script, I realized I had nothing the "Pods/Target Support Files" directory. However I do have a Pods/Pods-resources.sh which contains the line:
'--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"'
So, realizing that the recommended script simply appended:
--app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${BUILD_DIR}/assetcatalog_generated_info.plist"
I went ahead and appended that line above, and this solved the problem. I noticed too that the Copy Pods Resources was the final Build Phase, and since there was only one script being run, this might be the correct adjustment to make. Hopefully someone else can benefit from this discovery.
@Dengz but sometimes run the app, the icon will disappear again! most of the time, it is well
Most helpful comment
I have the same problem, a little research has shown a possible problem:
At first xcode compiles assets in the "Copy Bundle Resources" build step using --app-icon argument.
After that, in step "[CP] Copy Pods Resources" Pods-your_project_name-resources.sh compiles assets from dependencies without --app-icon argument and overwrites Assets.car
Fix: Add --app-icon argument to the assets compilation command in Pods-your_project_name-resources.sh with the appropriate catalog and plist file.
Adding this code to the Podfile should help: