Build error after I localized Info.plist - ios

I localized Info.plist :
And I got this build error :
error: could not read data from '/Users/cherif/Apps/Wesh/Info.plist':
The file “Info.plist” couldn’t be opened because there is no such file.
Actually there are now two Info.plist files :
fr.lproj/Info.plist
Base.lproj/Info.plist
How to localize the Info.plist path ?

Roll back those changes, add a InfoPlist.strings file to your project, localize it and then add the needed keys to it. For example:
"CFBundleDisplayName" = "App display name";
"CFBundleName" = "App bundle name";

To localized Info.plist :
Find in the x-code the folder Resources (is placed in root)
Select the folder Resources
Then press the main menu File->New->File...
Select in section "Resource" Strings File and press Next
Then in Save As field write InfoPlist ONLY ("I" capital and "P" capital)
Then press Create
Then select the file InfoPlist.strings that created in Resources folder and press in the right menu the button "Localize"
Then you Select the Project from the Project Navigator and select the The project from project list
In the info tab at the bottom you can as many as language you want (There is in section Localizations)
The language you can see in Resources Folder
To localize the values ("key") from info.plist file you can open with a text editor and get all the keys you want to localize
You write any key as the example in any InfoPlist.strings like the above example
"NSLocationAlwaysAndWhenInUseUsageDescription"="blabla";
"NSLocationAlwaysUsageDescription"="blabla2";
That's all work and you have localize your info.plist file!

Related

Unable to localise a string inside the iOS info.plist file

In my app, I want to support localization. I able to localise app using Localizable.strings except for Info.plist file. I want to localise app's privacy alert messages. I found below helpful links but it is not working with Xcode 9.4.1 and iOS 11+.
I followed the same steps:
Created InfoPlist.strings
Localised this file for selected languages
And added keys and values as : Key = "value"; in this InfoPlist.strings file
eg. NSContactsUsageDescription = "App use Contacts to select contacts";
Also found this file in "Project settings" -> "Build Phases" -> "Copy Bundle Resources"
Found some blogs/information as:
https://stackoverflow.com/a/25736915/1635315
Apple developer site
https://burcugeneci.wordpress.com/2015/11/19/can-you-localize-your-info-plist/
https://stackoverflow.com/a/26059896/1635315
Any idea how to do with Xcode 9.4.1 and iOS 11+?
Hai please refer the image shown below
check with the localization which you provided

Xamarin forms: Launcher icon for ios

I am trying to set the launcher icon for xamarin forms ios project from Mac.
I do the following things but still showing the default icon.
1.Double-Click the Info.plist file in the Solution Explorer to open it for editing.
2.Scroll down to the App Icons section.
3.From the Source dropdown list, select AppIcon-1.
4.Open Assets.xcassets and select App icons from the list.
5.Select the image file for the required type(Prerendered option is not checked). Some icons are already filled with the default icon and if I change that will get the file not found error.
XSAppIconAssets path in Info.plist is:
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon-1.appiconset</string>
Is there any additional set up for this task? I refer this blog: https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/images-icons/app-icons?tabs=vsmac
Thanks in advance.
It is because that Assets file path doesn't match the vaule in info.plist, your application cannot find it so use the default icons.
Right click info.plist and open it with XML(Text)Editor, you can find
<key>XSAppIconAssets</key>
<string>Resources/Images.xcassets/AppIcons.appiconset</string>
Right click Assets.xcassets and open containing folder , select its parent folder, you can find it locates at YourApp.iOS not Resources.
Solution
Change XSAppIconAssets from Resources/Images.xcassets/AppIcons.appiconset to Images.xcassets/AppIcons.appiconset , it should be able to solve the issue.

How to specify the path of localized Info.plist file

I had to localize Privacy - Camera Usage Description key located in Info.plist. So what I did, is that I've localized it through the File Inspector. What happened is that Info.plist is moved to the Base.lproj. That is fine. Then, again inside of File Inspector, Localization section, I checked two more languages.
By doing this, additional Info.plist files are added into appropriate .lproj directories. So after I have added desired translations I run the project, but Xcode throw an error which says that path of Info.plist is wrong. That make sense because Info.plist is not at the same location anymore. So I've gone into Project Navigator, Build Settings section, and found a key that says Info.plist File and set its value to something like this:
MyProjectName/Base.lproj/Info.plist
Because the Info.plist file exists at that path, I was able to build/run an app, but still, it loads only the translation for the base language (english).
So, how should I specify the path of a localized Info.plist file ?
You should use an InfoPlist.string file. here is a related issue.
How to localise a string inside the iOS info.plist file?

Can't localize info.plist strings

I need to localize two keys of info.plist: NSLocationUsageDescription and NSCameraUsageDescription. So I tried to create a new file called InfoPlist.strings and then I localized it, but app always shows strings stored in info.plist file. What's wrong?
Official documentation from Information Property List Key Reference
Localized values are not stored in the Info.plist file itself.
Instead, you store the values for a particular localization in a
strings file with the name InfoPlist.strings. You place this file in
the same language-specific project directory that you use to store
other resources for the same localization. The contents of the
InfoPlist.strings file are the individual keys you want localized and
the appropriately translated value. The routines that look up key
values in the Info.plist file take the user’s language preferences
into account and return the localized version of the key (from the
appropriate InfoPlist.strings file) when one exists. If a localized
version of a key does not exist, the routines return the value stored
in the Info.plist file.
My InfoPlist.strings file:
NSCameraUsageDescription = "hello";
NSLocationUsageDescription = "hello hello";
Please check in the generated application package, whether the file is really stored in there and it is put to the correct location. Usually this is the missing step.
Just go into the project settings, open "Build Phases" and see whether
the file can be found in "Copy Bundle Resources"
Your plist file can have multiple versions for each language your application supports.
In Utilities \ File Inspector (on the right) click on "Localize":
And then choose the languages you want to have their own versions:
After that you will be able to enter each plist file and edit it as you want.
InfoPlist.strings doesn't consider your scheme's Application Region, but the region set in the device! On your device: Settings-> General -> Language & Region, check if iPhone Language is the one that you like.
Since iOS 10, you are required to add the privacy keys to your Info.plist.
<key>NSPhotoLibraryUsageDescription</key>
<string>Please allow access to the photo library.</string>
Of course, you still need those keys to be localized (and you can't localize the application's Info.plist). So you ALSO add those privacy keys to the InfoPlist.strings, which in turn are localized.
"NSPhotoLibraryUsageDescription" = "Please allow access to the photo library.";
As a matter of fact, my problem was that I had misspelled the NSLocationWhenInUseUsageDescription constant so of course it was not taken into account.
Sometimes you have to make a Clean first, Click Menu -> Product -> Clean.
In my case there was a conflict with other InfoPlist.strings file from another build target.
After double checking everything said in this thread, my last action was deleting the app and its' data then re-run/re-install it to Simulator and my localization worked for Info.plist
One more thing, I made the simulator main language the testing language I want (Arabic), and to change that in the simulator Settings>General>Language
The file needs to be inside of a directory indicating the language, for example en.lproj
It depends on your iPhone or iPad ‘s language, it will automatically pick the description from the "InfoPlist.strings" file.

Why can't I paste the child pane plist file into a project's Settings.bundle folder in Xcode 4.3.3?

I'm running Xcode 4.3.3 and I've been following a tutorial about app settings. Everything has been going great up until I get ready to add a plist for a child pane that I want to add.
I tried the suggestion in a very similar question (http://stackoverflow.com/q/6978203/1543207) and I'm following the same tutorial as specified within the linked post.
Open up finder, you can right click or two finger click Settings.bundle and choose "Show in Finder".
Right click Settings.bundle in the finder window, choose show package contents.
Copy the new plist file into this the settings.bundle next to the Root.plist
Delete the new plist from the main project.
I can copy the plist file but I can't paste the plist file created into settings.bundle.
Any help would be greatly appreciated.
I got it.In Xcode 4.3.2,
Right click the Project Name in the Project Navigator, and choose Show in Finder;
In Finder, right click the setting.bundle and choose Show Package Contents;
Copy the new .plist to setting.bundle;
Back to XCode, open the setting.bundle, wilfully add one item under the Preference Items, then expand it and modify the value of Type to Child Pane.I can't upload the image, so give the link of the blog.
I hope can help you.

Resources