usbong / LIKHA-Guide

Guide for creating LIKHAs
1 stars 0 forks source link

Should the Cover image be .jpg? #6

Closed masarapmabuhay closed 8 years ago

masarapmabuhay commented 8 years ago

I used .png instead of .jpg for the Cover image. It seems to produce a Warning when I RUN the app.

chrisamanse commented 8 years ago

Should the Cover image be .jpg?

No.

However, if you simply replaced it in the Finder in LIKHA/Assets.xcassets/Cover.imageset AND with a different filename (cover.jpg -> cover.png), then it won't work.

The reasoning behind this is that the filename is hardcoded in LIKHA/Assets.xcassets/Cover.imageset/Contents.json, which is automatically managed by Xcode. This is the current contents of Contents.json:

{
  "images" : [
    {
      "idiom" : "universal",
      "filename" : "cover.jpg",
      "scale" : "1x"
    },
    {
      "idiom" : "universal",
      "scale" : "2x"
    },
    {
      "idiom" : "universal",
      "scale" : "3x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

With this, if you manually replaced the image in the Finder in LIKHA/Assets.xcassets/Cover.imageset with a different filename, then you also have to update the value of "filename" in Contents.json. Alternatively, if you don't want to manually edit Contents.json, you can go to Xcode and Assets.xcassets -> Cover, you'll see your new image with its filename and a title "unassigned". Simply drag this unassigned image to the Universal 1x slot, then Xcode will update Contents.json automatically.

To avoid doing this, you must drag-and-drop the new image in Assests.xcassets -> Cover in Xcode. Normally, developers don't manually edit files inside Assets.xcassets, and only let Xcode handle the files inside it.

masarapmabuhay commented 8 years ago

D'accord. I can see that Contents.json is also present in the AppIcons folder. I was under the impression that there was only 1 Contents.json.

Merci bien!