Has anyone figured out how to add/edit values in the Info.plist of Xcode 13 yet? I see they moved the Info.plist from the navigator pane... but although I can find it, I'm not sure how to edit it.
It's a "feature."
You don't need it anymore. From the Release Notes:
Projects created from several templates no longer require configuration files such as entitlements and Info.plist files. Configure common fields in the target’s Info tab, and build settings in the project editor. These files are added to the project when additional fields are used. (68254857)
So, instead of inside Info.plist, edit properties like NSCameraUsageDescription here:
Project -> Targets -> Info -> Custom iOS Target Properties
The first time you add/edit, Xcode will automatically generate a new Info.plist file that’s kind of synced1 with Custom iOS Target Properties. Xcode will later merge them for you.
[1]: They’re not fully synced. Some properties like NSCameraUsageDescription will only appear in Custom iOS Target Properties, while Application requires iPhone environment will appear in both. I have no idea how Xcode determines this.
Want Info.plist back, completely?
You might want all of your app's properties in one place. Or maybe you don't trust Xcode with the merging. I spoke with an Apple engineer at WWDC21 about this... here's how to get the classic Info.plist back.
Create a new "Property List" file (File -> New -> File)
Name it Info.plist
Copy and paste the existing values from Project -> Targets -> Info -> Custom iOS Target Properties to Info.plist.
Copy
Paste
Note: Currently you can only select and copy 1 row at a time. If you want to save some time, here are the default contents in XML format. To use this, right-click Info.plist -> Open As -> Source Code, then paste.
Copy the path to Info.plist in the attributes inspector.
Paste the path here:
Project -> Targets -> Build Settings -> Info.plist File
Set Generate Info.plist File to No
Last step. Remove Info.plist from Copy Bundle Resources (select, then press the - button).
Project -> Targets -> Build Phases -> Copy Bundle Resources
Yep, that was a lot. But whether you want classic Info.plist or not is up to you — both are fine and won't change your app.
Xcode 13.3.1, macOS Monterey(12.0.1)
Here is the most simple solution which work for both swiftUI and Storyboard projects, if you are not able to find info.plist and want to add target properties like Privacy - Camera Usage Description and things like we can add in older Xcode version. Here is the solution...
***> Select target of you project on top of the files click on Info on
> top of the right side, now you can see "Custom iOS properties" like
> info.plist, do whatever you want.***
Target > Info
see the image below for reference
Here is a link to a raywenderlich tutorial: https://www.raywenderlich.com/19611194-multiplatform-app-tutorial-swiftui-and-xcode-12
The sample projects uses Xcode 12.0-compatible (objectVersion = 54) project format, created with the Multi Platform app template. I borrowed the plists from this project. Until the sample project is revised, it's nice to have a reference project (structure) for comparison.
This also applies to Xcode 14. To be brief, a few pieces of information about this change:
There is a good write up of the issue here:
https://useyourloaf.com/blog/xcode-13-missing-info.plist/
There is a good YouTube video (found in this page above):
https://youtu.be/mml9ZI81VKA
This issue applies to SwiftUI projects not Storyboard. Once you make
a change to the "standard" info settings, Xcode actually
automatically creates an info.plist file in your project navigator. You can then add more custom settings in the info.plist file.
Related
I have been using Info.plist in my projects, but recently I noticed that freshly generated new projects don't contain them anymore, and Info.plist is instead generated by Xcode at build time, from Info.plist Values section in target's Build settings.
I like this, as it would allow me to ship two projects (beta and non-beta one) from a same folder, without special build steps modifying the Info.plist for each project.
However, I noticed that:
Many Info.plist keys are missing in Build settings (eg. ITSAppUsesNonExemptEncryption, or NSLocationAlwaysUsageDescription/NSLocationUsageDescription/NSLocationWhenInUseUsageDescription), so I cannot set them from there. There also doesn't appear to be any + sign when hovering, which would let me add another key into that section.
And the way of adding INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; into a .pbxproj file, which I have found documented somewhere, no longer works.
Is there a way of adding additional keys into generated Info.plist? Or, is there a way of having both both Info.plist file in a filesystem, and Info.plist Values section in build settings, and make Xcode merge them during build?
Here is how the section looks like:
So, this was helpful (thank you Andrew!), but the core insight I got from experimenting is:
Xcode doesn't want to let you enter invalid keys in places they don't belong.
Build Settings only have basic properties, anything else belongs into the 'Info' section. Editing it will create a new Info.plist file with only the changed properties, which will then be merged with info.plist keys from build settings (I couldn't find a documentation for build order).
Some settings, like ITSAppUsesNonExemptEncryption for standalone watch-only apps have no place to go.
Apple mostly abandoned standalone watchapps, there is a ton of bugs around them and they don't care.
My Xcode is v10 and I'm developing a custom intent for SiriKit, targeting iOS 12.
In Xcode 10, custom intents are designed in .intentdefinition files, where you can define your own parameters for intent phrases as well as the title of the intent and Siri shortcut for that intent. Building a project with a .intentdefinition file makes Xcode automatically generate an INIntent derived class for that intent.
My issue is that in order to support other languages than English so that the intent's title is show in the system's language in General > Siri & Search when the user is able to manipulate shortcuts for custom intents, I need to provide localized intent title for my .intentdefinition file.
When I try to add another language for my .intentdefinition file in the File Inspector and then build the project I get:
duplicate output file '/Users/.../IntentDefinitionGenerated/Intents/MyCustomIntent.swift' on task: IntentDefinitionCodegen /Users/.../ru.lproj/Intents.intentdefinition
This is likely happening because Xcode sees multiple .intentdefinition files in .lproj folders and tries to generate a same named class for each of them.
How do I localize my .intentdefinition file for iOS 12?
Go to intentdefinition file -> File Inspector -> Select Localize -> Now select current language for your intentdefinition file.
This will convert your existing intentdefinition file for current language.
Now again select the same intentdefinitionfile, add other language -> it will create a new Intents.strings file where you can customize the text for other locales.
I had the same issue as #desmond-hume. In my case, I have an old xcode project that already contained some localizations before "Base" was available. The initial .intentdefinition file must be added as the Base localization. From there, further localization can be added and Xcode will add only a .strings file for each localization.
Without a base localization, Xcode adds a new .intentdefinition for each localization which causes the "multiple commands produce...." error.
You can add a Base localization under the main project settings via a checkbox.
Some old projects (like mine) may also run into this issue:
iOS - Using Base localization pane is always empty
It looks like you've already localized your Intent Definition file (since Xcode has put it into a ru.lproj folder) so the problem might be that you've two copies of the file in the "Compile Sources" build phase.
Go here:
Project -> App target -> Build Phases -> Compile Sources
and look for duplicate entries. If you find a duplicate, delete one of the copies
You can also try Editor > Validate Settings… to find duplicates
You can also try cleaning the build
I've recently Localised the intents for my App, however after the original localisation, I added another Intent.
In Xcode 10.2.1 at least that I've checked, there is an "Export for Localization" option when you select the top level of your project.
It will ask you to save the output.
When you investigate your output, you should see an .xcloc folder for EACH of the languages you support.
Dig down to the .xliff under "Localized Contents" and open it.
There you will find your treasure trove of the items and you're looking for and you're looking for items that don't have a 'target'
The engineers at Apple at dub dub showed me this, however I personally wasn't happy of this process, as you have to edit it, and then re-import it (assuming you send off your files to a translator and get an .xliff back.
The annoyance though with Intents is the fact that it uses arbitrary IDs and not something legible
I haven't found an easier way (yet) to locate the missing translations.
Hope this helps!
you must be Project->info checked "Use Base Internationalization"
Next use the top answer method to create
Goal: create some localized strings and use them in Info.plist.
Standard Solution: create InfoPlist.strings and enable localization for it.
Fact: My Info.plist is actually named "Abc Xyz-Info.plist" (there is a space between Abc and Xyz). And I tried to create "Abc Xyz-InfoPlist.strings" and "AbcXyz-InfoPlist.strings", neither of them works.
Question: How to make the localization work for my renamed Info.plist?
Thank you very much.
It turns out that the conventional naming works: InfoPlist.strings. It doesn't matter how you name your Info.plist file, as long as the xcodeproj config is correct (Project -> Build Settings -> Packaging -> Info.plist File, the value is set to the correct path or your Info.plist file).
Steps:
Create a new file: iOS -> Resource -> Strings File -> InfoPlist.strings;
Xcode should automatically add corresponding metadata to your project.pbxproj;
Show Utilities and enable localization for it;
Add content to it.
Tested OK with Xcode 7.1.1(7B1005).
Do not rename InfoPlist.strings and enable localization for it. Xcode will take care of the rest. There is usually one created by default in all Xcode projects, did you remove it ?
I am having one sub-project[.xcodeproject folder] inside the main project. I want to update the info.plist file of the sub-project, but I am not able to find it. When I open the sub-project as the main project, and see the Info tab of it, I don't see table with Key, Type, Value columns but instead they have 3 sections - Deployment Target, Configurations, Localizations.
Can anyone help me with it?
The main project is using iOS9 beta and Xcode 7.0 beta 3, but the framework project which I am putting inside the main project was originally written for some older iOS versions.
Thanks!
What you are seeing is the "Info" section of the target. This is not the same thing as the Info.plist file, although there is a connection (app identifier, target version, etc). What you are looking for a file Info.plist. This is usually found under the "Supporting Files" sub-folder in the target project. Try expanding this folder. If you still cannot find it, try searching the project for it or open the project in Finder and look for it there. If you still cannot find it, this means that something has gone wrong and I would say recreate it.
Hope this helps!
I'm sure there is something messed up in the project file but I have not been able to find it (it's a legacy project new to me).
If I remove the reference to info.plist in the project, then it will successfully import and export, which is a workaround, but not ideal (obviously, although it's easy to revert).
I have searched for duplicate info.plist files and there are none that I can see (there actually are for the watchkit extension and app, but those are named differently anyway).
The actual name of my info.plist is like myapp-info.plist, but it is correctly named in the build settings--the project builds fine.
I have googled the heck out of this and can't find any other reports so I'm really stuck. Next step is to burn an Apple tech support request and when I do, I'll report back, but I thought I would ask the SO community first.
Thank you!
I had this same error. To fix it, I had to localize the *-info.plist file. Select the info.plist file and click "Localize..." in the File Inspector pane.
I don't know if you have solved this problem but I had the same issue. I think it happens when you change the project name and the build settings do not do its job to reflect the change. The Test info.plist refers to the same target original plist and seems to cause this problem.
Go to build settings in your project>Target>Project-name-Tests>Build Settings. Then locate Packaging>Info.plist File and change the folder to project-nameTest/Info.plist.
I hope this does the trick.
My experience was different here. I have multiple targets that all use the same code base. At some point (ostensibly due to a bad manual merge) the Info.plist setting in the Build Settings tab got set to the same value for multiple targets.
Once I straightened all of those out, I was able to export the Xliff file without any issues.
I was receiving this error message in Xcode 7.3.1 and what I did was create a new empty project in Xcode and model my info.plist files after that. This involved:
renaming my [app name]-Info.plist file to Info.plist and moving it out of Supporting Files to the main folder
going to project target (General tab) and selecting the renamed file. There should be a button for 'Choose Info.plist File'
doing similarly in the Tests folder. I don't think this step is necessary to fix the error but did it for consistency.
I was looking at this question on SO - Duplicate localized resource "/Localizable.strings" found xcode 6.1 - and I was able to export to .xliff successfully when I removed reference to the ProjectName-Info.plist file.
I re-added the file, and the project compiled successfully. You have to remove the reference again every time you want to export/import and re-add the file again.
I wasn't able to import updated .xliff files successfully, but I'm thinking on using just Localizable.strings file moving forward. I'm just happy that Project -> Editor -> Export for localization finally worked!