Xamarin.iOS localization of NSLocationWhenInUseUsageDescription - ios

Is there a way to localise the NSLocationWhenInUseUsageDescription in Info.plist in the Xamarin Studio?
Or any possibility to localise the complete Info.plist would be a solution as well.
I tried the following steps as it looks analogue to the
How to localise a string inside the iOS info.plist file? but it does not work for me.
So these are the steps:
In both en.proj and de.proj:
I added an empty file InfoPlist.strings
In Info.plist:
I have set the key of the "NSLocationWhenInUseUsageDescription" to "NSLocationWhenInUseUsageDescriptionMessage".
In InfoPlist.strings:
I added the "NSLocationWhenInUseUsageDescriptionMessage" as key in the strings files and the corresponding transitions in each, but it seems not to work -> the raw string "NSLocationWhenInUseUsageDescriptionMessage" is shown when the user is asked for the permission.

I had similar problem (only I used "Always" instead of "WhenInUse". Here's what worked:
In both en.lproj and de.lproj add the file InfoPlist.strings. Each of the files contains only one line:
"NSLocationAlwaysUsageDescription" = "Your location needed, because...";
In Info.plist, the string doesn't matter anymore, because it will be taken from the InfoPlist.string file. The relevant lines in Info.plist look like this:
<key>NSLocationAlwaysUsageDescription</key>
<string>No text needed here.</string>
Maybe you forgot the semicolon in the strings-files? Or your two folders were named *.proj instead of *.lproj?

We faced a similar issue for the localization of NSLocationWhenInUseUsageDescription. The translation was shown on the iOS simulator but never on real devices. After we fixed our CFBundleLocalizations array from upper case language codes to lower case in the Info.plist the permission description was translated correctly for all languages.
Not correct:
<key>CFBundleLocalizations</key>
<array>
<string>EN</string>
<string>DE</string>
<string>BG</string>
<string>PL</string>
<string>FR</string>
<string>CS</string>
</array>
Correct:
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>de</string>
<string>bg</string>
<string>pl</string>
<string>fr</string>
<string>cs</string>
</array>

Related

Getting error "does not have a CFBundleName key with a non-zero length string value in its Info.plist"

I am working with xcode 8.3 and swift 3.1
I getting error when I run the project like
does not have a CFBundleName key with a non-zero length string value in its Info.plist
I don't have made any change in plist.
I've just ran into this issue myself, and although the error states the issue lies with CFBundleName, it was fixed by adding CFBundleDisplayName and a string value to the main app target, as well as the extension target.
See below:
MainApp/Info.plist
<key>CFBundleDisplayName</key>
<string>My App</string>
AppExtension/Info.plist
<key>CFBundleDisplayName</key>
<string>My App</string>

How to translate ios cordova long press.

I am new to HTML5 development and I am building a simple cordova app. In IOS when you click a text and press long press you will see the following options.
Copy
Select All
Define
Share...
Is there a way to translate this words.
I changed the language of the phone but the above options are not translating.
Can anyone help me. Thank you.
You can add other languages to your project adding this on the info.plit (with a plugin or a hook)
<key>CFBundleLocalizations</key>
<array>
<string>es</string>
<string>fr</string>
<string>...</string>
</array>
or if you just support one language, you can just change English here for another language
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
There is an existing plugin to write on the info.plist
https://www.npmjs.com/package/cordova-custom-config
You can use it or use your own plugin that just a config-file tag to add that lines
http://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#config-file

Is there a way to refer to the CFBundleIdentifier elsewhere in the Info.plist file?

For our game, in the Info.plist file, our CFBundleIdentifier is set as,
<key>CFBundleIdentifier</key>
<string>com.sixminute.$(PRODUCT_NAME:rfc1034identifier)</string>
But then, for Google Play Sign in, we need the following URL Types in CFBundleURLTypes,
<key>CFBundleURLName</key>
<string>com.sixminute.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.sixminute.$(PRODUCT_NAME:rfc1034identifier)</string>
</array>
is there any way we could instead reference the CFBundleIdentifier dynamically like $(BUNDLE_IDENTIFIER) or similar?
You can define user-variables in XCode in your target properties by following these steps :
Go to "Build settings" of your target app
Select Menu "Editor"-> "Add Build Setting" -> "Add User-Defined Setting"
Name your variable (e.g. "BundleId") and its value for each configurations
Then in your plist file you can simply use :
<key>CFBundleIdentifier</key>
<string>${BundleId}</string>
you can not dynamically update CFBundleIdentifier later(or programmatically) and you can only add value to it compile time. Your question is also not clear, if you are referring something else.
BTW, CFBundleIdentifier and CFBundleURLName/CFBundleURLSchemes are completely orthogonal.

iOS: Require Retina Display in plist

This is an odd request, but I would like to be able to require devices to have a retina display in order to build an application. Is there a key and value I can add to my plist to add that build requirement?
You can check if there id a front camera, and set it in the info.plist UIRequiredDeviceCapabilities key.
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>front-facing-camera</string>
</array>
look here for more details:
iPhoneOSKeys
BTW
That will work for iPhone only.

Icon already includes gloss effects

I have a problem with the gloss effect in app icon at iOS 5 beta 5, in iOS 4 it's show the effect not gloss, but iOS5 shows the gloss effect. I put the option Icon already includes gloss effects = YES, but simply does not work, and it appears that the application Google+ also has the same problem
iOS 5 has anew "Icon Files (iOS 5)" key in the Info.plist file. Make sure the "Icon already includes gloss effect" boolean in that dict is set to "YES" too. You may need to clear your build folder before the changes take effect in the simulator. It takes a lot of troubleshooting to get it to work on older projects, so you might try erasing the root level key.
First Settings in a your project info-list set key Icon already inculdes gloss effects to YES Boolean value like below screen shot:
after try project Target settings tick the checkbox in the summary tap in the App Icons section
like below screen shot:
it's worked for me!
Welcome in Advance!
It appears this problem is still not fixed in the GM.
I set UIPrerenderedIcon to YES, but the rendered icon includes gloss effect.
Sorry, I confirmed that this problem is solved in the GM. If you would like to erase gross effect, set "Icon already includes gross effect" under "Primary Icons" under "Icon files (iOS 5)" to YES.
There are 2 keys in the Info.plist governing this.
xCode generated the following code for you, but it doesn't offer a GUI for changing this:
Open your Info.plist file (Right Click > Open As > Source Code).
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>myIcon.png</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
set the UIPrerenderedIcon = true and you are good to go (this is NOT the other UIPrerenderedIcon that also exists in this file as a boolean key!).
Just in case anyone stumbles across this due to a problem using an asset catalog in Xcode 5.0, there is a setting in the Attributes Inspector of the asset catalog that should be checked:
Some of you will do these things and still not have retina display or gloss to reflect these changes.
In XCode 4.3.2 and possibly earlier versions, make sure you check the "Summary" tab in your project settings. There you will find a section called "App Icons" that should show both your Icon.png and Icon#2x.png. Make sure you have the "Prerendered Icon" box checked.
Even after all this, you might not have the retina display working. Check the "Info" tab's "Custom iOS Target Properties" section.
Make sure you delete the "Newstand Icons" section if you aren't going to use them or it will stop your app from passing validation when submitting to the AppStore.
In the release notes for iOS5 Beta 6 it says:
FIXED: The UIPrerenderedIcon key (in the Info.plist file) is not
honored in this beta.
Yes, it's an iOS 5 bug. I'm sure it'll be fixed in the GM.
I had the same problem with an unwanted gloss effect using xCode 5.0. I went through all posted answers. Here is what worked for me:
1) Remove "Icon Already Includes Gloss Effects" from Info.plist. I did this because, although this is set to "YES", which should work properly -- for whatever reason, it wasn't working, so I wanted to remove it before adding the correct code.
Here's how to do it:
Click your project name in the navigator (left column) > then in the Editor (middle column) click info. In the field that states "Icon Includes Gloss Effects", click the minus "-" button to delete. This removes the code that is not working, so you will start with a clean palette.
2) Open your Info.plist file -- In the Navigator (left column), find the info.plist file then (Right Click > Open As > Source Code).
3) Your code will look like this:
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-120</string>
<string>Icon-72</string>
<string>Icon-57</string>
</array>
</dict>
Now copy the following 2 lines of code, because you will paste them into the code above:
<key>UIPrerenderedIcon</key>
<true/>
Your final code should look like this:
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>YourIconFile</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
This is the best answer I can provide. Worked for me.
What worked for me is to change the "Icon already includes gloss effect" boolean under "Icon Files (iOS 5)" first to NO, compile, then set the boolean to YES and compile.
I set “Icon already includes gloss effects = YES”
In the info.plist, search this part:
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>myIcon.png</string>
</array>
</dict>
</dict>
Now, add this 2 lines:
<key>UIPrerenderedIcon</key>
<false/>
At the end, It must to be:
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>myIcon.png</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>

Resources