flutter_launcher_icons icon indicating copy to clipboard operation
flutter_launcher_icons copied to clipboard

CLI does not create Contents.json for IOS

Open stefan-kolb opened this issue 5 years ago • 7 comments

flutter_launcher_icons ^1.7.2+1 does not create a Contents.json when running flutter packages pub run flutter_launcher_icons:main.

stefan-kolb avatar Jul 02 '19 14:07 stefan-kolb

Any plans to fix it?

fryette avatar Nov 27 '19 13:11 fryette

Hi ! I just made a ruby script that will generate the Contents.json lines. You just have to copy the code in a ruby file inside Appicon.appiconset folder, and run it from there (ruby myscript.rb) . It will print json to the console, and you just have to copy it to Contents.json file.

require "json"


puts "Application version ?"
version = gets.chomp

reg = /(?:Icon-App-([0-9]+\.?[0-9]?)x[0-9]+\.?[0-9]?+@([0-9])x\.png)/

hash = Hash.new
hash["images"] = Array.new

Dir.entries(".").each do |entry|
	puts entry	
	if match = entry.match(reg) then
		size, idx = match.captures

	item = Hash.new
	item["size"] = size.to_s + "x" + size.to_s
	item["filename"] = entry
	item["scale"] = idx.to_s + "x"
	item["idiom"] = "iphone"
	hash["images"].push(item)


	iItem = Hash.new
	iItem["size"] = size.to_s + "x" + size.to_s
	iItem["filename"] = entry
	iItem["scale"] = idx.to_s + "x"
	iItem["idiom"] = "ipad"
	hash["images"].push(iItem)
	end
	
	#add in hash images
end

	hash["info"] = Hash.new
	hash["info"]["version"] = version.to_i
	hash["info"]["author"] = "xcode"

puts JSON.pretty_generate(hash)

The missing thing is the app icon for App Store. Can be fixed looking at : this

johannphilippe avatar Mar 29 '20 17:03 johannphilippe

Any fix is in place for this? It seems with the latest versions also we have the same problem.

valishah avatar Jun 08 '20 21:06 valishah

I ran across the same issue. For those of you who are looking for a temporary solution, you can copy the Contents.json files from the example directory: https://github.com/fluttercommunity/flutter_launcher_icons/blob/master/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json

charleshan avatar Aug 04 '20 15:08 charleshan

For generation contents.json i uses this guy fork (found on network graph): https://github.com/karer/flutter_launcher_icons/commit/89c99d97a458130efa93459ab27933f37a64b43d

He just wrote one more line of code, please fix it on head repo!

cortrano avatar Nov 25 '20 15:11 cortrano

Contents.json file had already been moved. https://github.com/fluttercommunity/flutter_launcher_icons/blob/master/example/default/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json

RyosukeOK avatar Mar 24 '21 23:03 RyosukeOK

This is a way to overwrite contents.json for ios.

L3odr0id avatar Jun 09 '22 06:06 L3odr0id