2 Targets 1 Icon Name - objective-c

My program has two targets and I want to correctly configure this screen:
I successfully configure the "App Icon" and "Launch Images" in .plist file, setting the key CFBundleIconFile and CFBundleIconFiles (for icon) and UILaunchImageFile (for launch Image) in the .plist file.
To see this error yourself, try the following:
Create a new project
Create two or more targets for this project
Go to the screen above (select the project icon in XCode, in targets select the "summary" tab)
Select an image to be the icon of this target
The icon will be added to the project and automatically saved in the root project directory in the file system with the name "Icon.png"
Go to another target and select another image to be the icon of this target
Here is the problem. The system will say: "Want to replace this file?" If I say yes, it overwrites and the first target icon is replaced!!! If say no, nothing is done.
Is there a way to configure two different icons and two launch images to appear in this screen for each target? I can correctly configure it in the .plist file, but in this screen it looks like I have no image!

You need store icons in different folders.
Create 2 subfolders in "images" (in file system, not in Xcode)
2. Create corresponding "group" (yellow folder) in Xcode and set right path for them (optional)
3. Add all icons to project (in corresponding groups)
4. Set "Target membership" (in the right panel in Xcode) to right target for each icon.
5. The info.plist file(s) should reference to right icon name.
Also be aware of:
All files from subfolders of "images" will be placed in one root folder in device's file system, so it is never mind, that images located in different folders in developer's machine. If you have files with some name in different folders, only one may be placed in final bundle. It is why you need specify "Target membership".
Do not set arbitrary names for lancher icons. Some devices may no recognize icon, if it named arbitrary, ever if it is mentioned in info.plist file (see here).

Related

Launch Image source in xcode did not show

In my xcode 11.5, I am not able to see Launch Image Source from path Target->General->App icons and Launch Images-> Launch image source
I have referred following link but it does not help me.
Link
I have added below 2 lines of code into my info.plist file to provide larger screen support.
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
I have multiple targets in my application. So, each target has different splash screen. How can I achieve it?
You can create multiple Launch Screen Target.storyboards and you can add respective Launch Screen storyboard to respective target under File Inspector. Also you can create multiple Assets.xcassets for each target under different folder and add images specific
to each target. And add Assets.xcassets to respective target under File Inspector.

Interface Builder: custom fonts don't appear in list

I've added some custom fonts to the project:
The fonts are added to the target, are included in the "Copy Bundle Resources" list, and are also added to Info.plist under Fonts Provided by Application.
However, those fonts don't show correctly in the Interface Builder. It shows the font family (CentraleSans), but gives me only 2 font choices for that family.
Moreover, the actual font IB ends up using seems random (the final selection can be CentraleSansBold or CentraleSansBook, or other ones, for the same family/font values I pick). Notice how in the screenshot above it says "CentraleSansBook", even though that was not an option in the drop down list. Is this an IB bug?
OK, I found a way to make it work. I had to install the custom fonts on my Mac. Double-click on the font file in Finder, then click "Install Font". After that the font will appear in the drop down list in IB.

XCode display a project image in the credits.rtf file

I want to take an image from my project and add it to the "About MyApp" window.
This seemed as simple as adding the image to the credits.rtf file; once I dragged and dropped the image from the project to the credits.rtf file, it inserted the image into the file and I put it where I wanted it, but as soon as I ran the application, there was just a space where I had put the image.
Is there any way to show an image in the About MyApp menu (other than the application icon) without creating a custom NSView and changing the target of the About NSMenuItem?
I created a new Xcode project, selected it's 'Credits.rtf' file and pasted in an image, built and ran it and the image auto-magicly showed up in my "About…" dialog.
Note: it changed the file extension to '.rtfd' and I got the following dialog (sheet):

Cannot create localizable strings files copies in XCode4

I have a "Resources/en.lproj/Localized.strings" file, with some key/value pairs in the format:
"key"="value";
I select this file and in File Inspector in the Utilities Pane I choose to add a new localization (es) pressing the '+' button in the Localization tab.
This action should create a new file "Resources/es.lproj/Localized.strings", but instead the original "Resources/en.lproj/Localized.strings" now displays a small triangle at the left ( as if it were a folder ) and holds inside two files Localized.strings (English) and Localized.strings (Spanish). No es.lproj directory created.
I have never read of this behavior even in references to this using XCode4.
What I'm missing?
Updated info:
I have checked the app bundle installed in my iPhone Simulator and the folders are created there, with the corresponding files.
I don't know if this is the default way but is confusing to me since reading the documentation this is not what I understand.
Your could try this : Quit XCode, relaunch your project. Remove all localizations from your project properties (keeping the files when asked), add them back, remove es localization on your file, then add it back.

How to stop huge Prefix.pch.gch file from being copied into application bundle

For some reason, XCode has decided to start copying a huge Prefix.pch.gch file into my application's resources folder when building. This file is not in the Copy Bundle Resources build phase, nor can I find any other project setting that should tell XCode to do this. Has anyone seen this before and know what's going on?
I had a problem with the same symptoms today, it turned out that it was due to one of my objective C files being included in the Copy Bundle Resources files phase of the target (either due to a drag and drop accident, or the xcodeproj file getting corrupted at some point). GCC was then helpfully including the precompiled headers for the prefix header in the target as there is a dependency from the source file.
Doing a Get Info on the source file in question didn't show all the tabs on the file info dialog, even though the file type was set to sourcecode.c.objc.
Removing the file from the project and re-adding it cured the problem.
You could try doing "Show Package Contents" on your xcode project file in the finder, then opening the project.pbxproj file in a text editor (not xcode).
If you search for ".pch" and/or ".gch", you might spot something.
Are there any Copy Files phases?
Is the Prefix.pch.gch file in your project's group tree? The easiest way to check this would be to select the project object, then search for “gch” in the Detail view.
I solved this problem in a different way. Firstly I like to make use of the prefix file so I have lots of includes for standard logging, colours etc.
For every include to the prefix file ensure that each include is only processed once! This can be done by putting:
#ifndef __<Classname>__
#define __<Classname>__
< your original header file here >
#endif
If you select the "Project" item of the "Project menu and then the "Detail" tab view and then select the project in the "Groups & Files" list on the left is the files listed on the right view have a checkbox? and is that checkbox checked? if so then un-check it.