How to setup a separate iTunesArtwork file for each Target - ios

I have a xcode project with many targets and each target has its own App Icon and Launcher Icon
It's fair to expect that each target has its own iTunesArtwork file.
But the problem here is
The name of the file can't be changed and it should be with the name iTunesArtwork
so I can't add a yet another file in the same project for a different target
The iTunesArtwork has to be in the root of the project or else it'd be ignored
I tried creating different folders for different targets and in the respective folder I dragged and dropped the respective iTunesArtwork but iTunes Completely ignored it.
so is there any way while building the app we can move a file from the respective folder to project root ?
or
is there any other way I achieve this through ?
Note:
I am using jenkins

I solved the problem using Folder references in xcode
Here are the steps
I opened my project in the finder then I created a physical folder
for each target and there I kept the iTunesArtwork and
iTunesArtwork#2x for respective targets
(This folders won't be visible in xcode since we're doing it in the finder and as we have physical directory no name collision problem)
In xcode I opened my project and I created a Group for each Target
I dragged and dropped the iTunesArtwork & iTunesArtwork2x in the
respective Group and I chose the respective target in Target list
and I chose Folder references

Create new image.xcess asset and select target- build settings find xassets replace that neme for your inageassets name for that target

Related

Add images in project in new Xcode 9

In new Xcode 9 I want to add images in project. But If I add images and try to use it in code or in storyboard my images not showing in simulator. But in Xcode 8 all works fine. How to fix it?
Note : This Problem does not Exist Anymore in newer XCode
If you have dragged image in your project, you must select Copy If Needed While adding any file into your project.
After Adding Image take a look at your image if it is available to target, I have face similar issue with other file types too.
In xcode9 it was not selected by default even after selecting copy if needed.
Yes - this is super annoying. With XCode 9, now in addition to dragging a new image into the XCode Project Navigator (the left-hand list of files), you now have to go into Targets for your project, go to "Build Phases" and manually add the image file to "Copy Bundle Resources" using the "+" button at the bottom of the list of files.
This is required for any object you used to have to just drag into the project, including third-party frameworks and bundles.
PS: in dragging the image into your project you don't have to have "Copy Item if needed" selected if the image file is already somewhere in your project folder or a subfolder thereof.
If you have to handle multiple images, it is probably more convenient to copy the resources to your target app in the General Settings > Build Phases > Copy Bundle Resources
Copy Bundle Resources
This does the same as checking Target Membership for the resource – but you can add multiple images to your target app at once.
Check release notes of XCode 9.1:
Adding files to a project now adds them to the selected targets. (34551617)
https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html

How can I add file to project in Xcode 9?

I created a new project in xcode 9.
I want to add image file to project.
When I delete this file from desktop,
Image file appears in red?
But in project folder, I find this image file.
In Xcode 8 its working fine,
Any idea?
It is an Xcode9-beta (9M136h) bug. I don't know if it has been resolved in beta3 or not. Copy items if needed copies the file to your project directory but still links to the original file.
What I do is, after dragging the file to my project, I select the folder icon (see red circle in the image below) from File Inspector and point to the copied file in the project directory.
#pesch's approach works too. First copy the image to your project folder and then drag it to Xcode.
Xcode 9 allows to have folders in Xcode synced with folder in your Finder structure. I assume this is a bug since Xcode 9 is still in beta and you are "ticking" the Copy items if needed.
Try moving the image to your project folder yourself and drag it from there to Xcode.
This is what you would do to leave the Copy items if needed box unticked since you are doing it yourself.
It looks like a XCode 9 bug. If you check the Full Path of your image file in Identity and Type Tab, it would show the location of the deleted file, hence the deleted(red) color.
You can delete that reference and can use Add File To.. option to add the reference of (already) copied image from your source folder.
Although this is not resource related (images, etc). The issue that I'm currently facing with the Xcode 9.0 GM build is that adding the items to the project does not actually added them to my targets, although I selected them.
Step 1 - Add Files to Project
Add New Files and Select your targets
Step 2 - View Files in File Inspector
You can clearly see in the file inspector that it is not added to those targets accordingly.
Step 3 - [Fix] Add New Added File to Targets
To Fix this, just check the targets that the files should be added to and you should be good :)
I have seen this issue in Xcode 9.0 GM (build 9A235, same as the current release). It's intermittent; sometimes 'Copy items if needed' is honored, sometimes not.
In one case it seemed to be triggered by the presence of source control. I was working through an online tutorial where the provided project had no source control. Adding files here did honor the 'copy items' checkbox, but if I made the provided project a git repository first, adding files ignored the checkbox every time.

What file to update in an XCode project when some folders names are updated?

I have changed the name of two folders of an XCode project and when I open this project, it doesn't work anymore (XCode can't find the files where the name of the folders were changed). I know it's a little issue and I have tried to find where to update the references to these particular folders in XCode but couldn't find how to.
I have changed where it is written "NewName"
Can you help me to solve that ?
Thanks
Blue Folders in Xcode are physical folders on disk in the project folder.
Navigate to the project folder in Finder by right-clicking on a valid item in the side bar > Show in Finder, quit Xcode, rename the folders in Finder accordingly and reopen the project.
Then check the Build Settings of the target if there are any path references using the old folder names and change them, too.

Is my xcode project duplicating itself?

I have an Xcode project. I see that there is a folder within the project folder in my Finder with exactly the same name as the project folder and this folder contains a copy of the project and includes, you guessed it, a copy of the project within again and again. The project folder is now 5Gb while the app itself is no more than 25Mb. So I think that the project somehow is making copies of itself. I see that in my Project I have two targets, one of the project name and one with the project name + "- copy" at the end of the target name.
I wonder what I should do to stop my project increasing in size and how to safely remove the copied project folder within.
there was a copy of the project in the target, the solution is to remove the offending folder form within the project in finder and then to remove the copied project in the target.

Multiple versions of iTunesArtwork in one project?

I have a single Xcode project with several targets, each spitting out a different app with a different icon. The icons are in their target-specific resource folders so they don't collide.
But the 'iTunesArtwork' file (i.e., the icon used for display of Ad Hoc builds in iTunes) must be placed in a specific location (Project Root), and named exactly that, so multiple versions can't coexist.
Any workarounds?
You must be able to do the same trick with the Artworks file, store several files (with the same name) at different folders, add them to the project respecting the files Target Membership (File Inspector section).
They don't have to be in the project root. If there're several icon files at different project folders, each icon is a member of it's own target, then you have different target icons with the same icon name (and naturally the only icon file is copied to the bundle root).
You might need to have one of the icons at the project root folder (e.g. it might be copied there for you by Xcode), but during the build the icons should be copied from the folders referenced in the project rather than from the project's root folder.

Resources