Use custom file names for iOS launch images - iphone

Is it possible to define my own naming convention for iOS app splash/launch images as I can with Icon files (e.g. via an Info.plist entry), or must I stick to the ...#2x.png and ...-568h#2x.png naming?

You can change the root name (the “Default” bit) with the UILaunchImageFile key, which has been available since iOS 3.2, but in that case the suffixes—#2x, -568h#2x, etc.—are still fixed. To supply a set of arbitrary images, you can use the UILaunchImages array, but be advised that that API is iOS 7-only.

If you use an Asset Catalog (new in XCode5), you can use whatever file naming convention you like. The Asset Catalog takes care of mapping a logical name for an image resource to a set of files on disk.

Related

How to Localize NSPhotoLibraryUsageDescription key (ALAssets)

I'm trying to localize the NSPhotoLibraryUsageDescription key defined in the application's info.plist file (reference here).
This key gives you a point to provide custom message when the app is first asking for access to your camera roll.
I'm using ALAssetsLibrary to enumerate assets groups (which triggers the access request message to pop-up).
So far my googling doesn't answer how I could achieve this.
I want to avoid localizing the whole info.plist file as it contain a lot more non-locale dependent content.
Anyone already solved this or have hints how to proceed?
There is a file you can create (which may be created for you when you create a project) called InfoPlist.strings. This file is used and localized much like the file Localizable.strings.
In it you would have and entry something like:
NSPhotoLibraryUsageDescription = "Test of new Photos warnings";
Note that there are no quotation marks around the key
I think as long as the key is included in info.plist, it will localized using the value in InfoPlist.string if it is available for the language. Otherwise it will use whatever is defined in info.plist.
I have my note here https://github.com/onmyway133/notes/issues/290, or you will get
Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
Once these issues have been corrected, you can then redeliver the corrected binary.
Make sure
You declare the keys in Info.plist
You localize it in InfoPlist.strings
You don't need double quotes, like "NSPhotoLibraryUsageDescription" = "Test of new Photos warnings";, you can just use NSPhotoLibraryUsageDescription = "Test of new Photos warnings";
The only way to make this work for me was in Xcode to:
1) Go to Project target -> Info-> Localization-> Add localization
Added language there. This operation created the <projectName>/<LanguageInitials>.lproj folder.
2) I created file InfoPlist.strings inside the folder <projectName>/<LanguageInitials>.lproj;
3) I added the text:
NSPhotoLibraryUsageDescription = "<Add your translated text here>";
inside that InfoPlist.strings file.
4) I then added that folder to the project with File -> add new files to the project or drag and drop.
Note: to test this I:
Cleaned cache, set the language on simulator to be the new one, edited the language in scheme to be the new one at running on simulator and restarted the simulator.

Creating a Lite version of an App using Targets

I would like to create a Lite version of an app, I'm not entirely sure on the process of doing so however. I duplicate the target. Then what? For instance, I changed the name of the duplicated target from AppName Copy, to AppName Lite, and also changed the name of the newly generated plist, however, in products the .app file is still incorrectly named and I can't change it. Is there some sort of official procedure that I could follow?
You need to change product name for target from Build Settings. Follow this blog

where in an XCode project does it set "InfoPlist.strings" as the filename to use for locationalization?

where in an XCode project does it set "InfoPlist.strings" as the filename to use for locationalization?
Just trying to understand how XCode pulls things together here. For example to set the app name specifically I can change this in "AppName_plist-Info.plist", however if I go localization it seems it then has to be set via the "InfoPlist.strings" files.
I can see in XCode where it specifies the "AppName_plist-Info.plist" file name, in the Target/BuildSettings/Packaging information area, but I don't see mention of "InfoPlist.strings", so how does Xcode/IOS know to override what is in "AppName_plist-Info.plist" based on what's in "InfoPlist.strings"?
Xcode doesn't really override the name, it creates localizations in your apps bundle. iOS will look for the name of the app in de localization folder to which the language of the system is set.
These files have pre-determent names, thus you can not set them.
All the localized files will be for example in bundle.app\en.lproj for english or bundle.app\nl.lprojfor dutch.

How does Monotouch manage resources (strings, images, etc.)?

In Android I put my application strings in a file called strings.xml. For example, for an Italian translation I need to create a values-it folder and put a strings.xml file with Italian labels inside this new folder.
How does Monotouch manage such internationalization of strings?
You would generally use Apple's localization features - special "lproj" folders in your app bundle containing localized versions of your nibs, files, string resources etc.
You can find more info in Apple's iOS Internationalization docs, and there are also some third-party tutorials that are useful.
Although MonoDevelop does not provide any explicit support for localization, simply adding the lproj folders to your project root and marking their contents as "Content" should add them into the app bundle properly.
Any resource you load from the bundle should then load the appropriate localized version, if present. This includes APIs that automatically load items from the bundle, such as instantiating views from xibs/nibs, and also APIs to explicit retrieve resources from the bundle. For example NSBundle.LocalizedString will load the appropriate string from your strings resources.

Using info.plist for storing target-specific values for a multi-target app

I have a multi-target iPhone app which currently includes a header file with constant definitions that are conditionally included at build time depending on which target is being built.
However, I was wondering if it might be better to instead include this information in the info.plist for the build, as this generally holds target-specific meta, so logically seems more appropriate.
Therefore, my questions are:
Is it acceptable to include custom (non-Apple defined) keys in the info.plist file?
Is this a suitable place to include meta for the app which differ between targets?
It is acceptable and suitable.
The Info.plist file is preprocessed (must be enabled in project settings by setting Packaging / Preprocess Info.plist File to Yes) by the C pre-processor, so you can have variables (in the form of ${VARIABLE_NAME}). These variables can be defined in the User Defined section in Xcode's target info, making it very easy to switch their value from one target to another.