I have a Cocoa app and I want to use the default About window like this:
How can I change the text? ex:
Engineering:
Some people (I want to change this text to the real developer)
Can it be configured somewhere in the info.plist file? I can't find any related key after reading the Apple document about info.plist.
Look in the en.lproj folder for a file called "Credits.rtf"
You can edit the Credits.rtf file in most editors. Xcode is a bit limited, compared to even TextEdit.
Related
Is there any way to change the settings of Xcode programmatically through Terminal? i.e. color scheme, key binding, etc.
I'm aware of Apple's Commandline Tools for Xcode for building,
but there seems to be no command for altering the settings of the GUI.
It doesn't have to be an official way. I am looking for a way to get to the settings file related to Xcode. I've found some in here, but not sure how to change them.
/Users/YOURUSERNAMEHERE/Library/Developer/Xcode/UserData
Thanks in advance.
The defaults command can be used to modify Xcode preferences:
term> defaults write com.apple.dt.Xcode.plist Xcode3BuildRulesEditorDisplayMode 1
As Naoto Ida mentioned, changes here will most likely not effect Xcode until it's relaunched.
I believe I may have found the answer.
/Users/YOURUSERNAMEHERE/Library/Preferences/com.apple.dt.Xcode.plist
seemed to contain all the user settings for Xcode.
This file is in binary format, so one must do this command:
plutil -convert xml1 -o - /Users/YOURUSERNAMEHERE/Library/Preferences/com.apple.dt.Xcode.plist
Then, you can see that it is in an XML format.
You can, as #geowar suggests, write a command to make changes to the file, the changes to these files won't immediately come into effect, as these are cached elsewhere, meaning Xcode needs a restart.
I think I'm literally on the last step before submitting a new Mac app, and I've been banging my head against a wall for the past few hours on what I think should be really, really easy.
I've designed document icons for the two different types of icons my app creates and works with. I created a new "Icon" in Images.xcassets, and dropped the appropriate files into the drop zones.
In the product editor -> Info, I go to where the document type information is, but when I try to enter in the icon name in the "icon" field of either the Document Types or Exported UTI section, the icon image just turns into a question mark—no options show up in the drop down menus for icons.
How do I get the images/icons in the asset catalog to show up in the editor? Alternatively, if I was going to enter that manually into the plist, what sort of format would I use to reference an Icon file from the asset catalog?
I know I'm probably missing an easy step here, but I can't see it!
To my knowledge, Xcode doesn't currently support using .xcassets for document icons. This is a little strange—the .xcassets editor clearly allows you to create new icons, but it doesn't generate .icns files, it just puts all the files in the same folder and uses a plist to manage them.
To create an icon for your document types, upload the 1024x1024 version of the icon to http://iconverticons.com/online/ to convert it to a .icns file. Alternatively, you could use a third-party tool to generate an .icns file with different images for different resolutions. There used to be a great tool included in the Developer Tools for doing this, but I can't seem to find it anymore.
Once you've got an icns file, add it to your project and you should be able to select it as the "Icon" for your Document Type or External/Internal UTI. Enjoy!
To be honest, it might be worth filing a bug about this. Xcode's development seems so strongly driven by iOS these days, they may not have noticed this yet!
I did it in the most easy way:
Add "New OS X Icon" to images.xcassets and name it "DocIcon", for instance.
Drag and drop images of your document icon
Just type "DocIcon" to icon name of your document
You will see question mark as document icon thumbnail. Don't care about. All will work fine after build and launch of application.
This is what worked for me, using Xcode 10 in 2019 (none of the other answers worked in my case):
Select asset catalog in Project Navigator
Right click on the left pane (list of assets) and choose App Icons & Launch Images ▶︎ New macOS Generic Icon (second option from bottom). Name it "Document". This will create a folder named "Document.iconset" in the asset catalog directory.
Populate all entries with your custom images. They must all be of the appropriate size (e.g., "16 x 16 #2x" must be 32 x 32 pixels, otherwise you will get yellow a warning icon over the image slot).
Navigate to the asset catalog folder, and use the command: iconutil -c icns Document.iconset (must match the name of the icon created in step #2). I took this command from Apple's documentation here (which by the way, also says some BS about Xcode "automatically creating an .icns file from your .iconset folder on build". Sure...).
Copy the newly created Document.icns file as a resource to your project.
Select the target, open the Info pane, and in both Document Types and Exported UTIs set your .icns file as the icon for the file type.
Hej, allesamme,
I had the same problem and have been researching it for days. I found a family of four solutions, the first three of which did not work for me: 1. using a .png file as the document type icon file; 2. using a manually created .icns file as the document type icon file; 3. the above solution, and 4. what I will describe here. Only the last one worked for me.
I tried following the spirit of the above advice and found that it didn't work, at least for my MacOS app. I'm on OS X 10.9.2 (13C64) running Xcode Version 5.1 (5B130a).
The current wisdom seems to be to create a directory in your workspace with a lower-case name and .iconset extension, in which one puts files with an icon_ prefix and the usual suffixes (16x16.png, 16x16#2x.png, 32x32.png, etc.)
In Product Editor's Info pane you can go into Document Types and associate the .iconset file with the Icon field. The icon image happily displays something reasonable. The build process builds a .icns file from that spec and copies it into your app.
I had an intermittent problem that the .icns file wouldn't build, which I traced to mistakenly haven included a 64x64 icon in the list. That's a no-no.
The current Apple dogma on this issue can be found in the official documentation, which covers some details I glossed over here. I didn't need to edit the Info.plist file directly: everything seemed to work from the interfaces provided in Xcode.
I have no idea which solutions work in which contexts, but thought I'd add throw more alternative on the fire for people to try out. — Jim Coplien
I am using Xcode 4.4.
As you may all know, there is an easy option to localize resource files in Xcode. You can also internationalize your plist Files, which is my approach.
But since 4.4 it doesn't seem to work properly anymore.
All you have to do is the following:
In <project>-Info.plist file add key "Localization" which adds a subarray where you add your country codes as items
now you can localize you resource file (like Localizable.strings) i.e. like so: followed by a modal screen where you're able to choose the languages defined in plist file
Enter! The resource file now lives in <country identifier>.lproj folder.
In Xcode 4.4 you cannot choose your language, defined in plist file. Only English.
I tried everything. Don't want to localize manually.
Also in Xcode versions below 4.4 it was possible to add new languages with a '+'-button. It is not possible:
Look at this:
Any suggestions. Or do I do it just the wrong way?
Here is how you localize your recources in Xcode 4.4+ :
Click on your project (navigator)
On 'Info' tab under your project you'll see the 'Localizations' section
Click on + to add a language
Choose the files you want to localize in the sheet that will be displayed
Now Xcode will automatically create and put your files under the respective language folders.
Finally if you want to localize other sources (such as image files), click on your file, bring the file inspector pane and click 'Make Localized...' button under 'Localization' section. Xcode will fire up another sheet with the available languages, choose the language and you're ready. I hope that this makes sense.
The question is, too, how to localize multiple Info.plist files for multiple targets.
This is done very easily. Just add the languages you want your localization in to the projectile, as described above.
Then you click your several Info.plist Files, each for each target.
Open up the Utilities sidebar
Click "Make localized"
Then choose between the in the project-file setup languages and you're done.
I'm generating a Windows .chm file using Robohelp 8. The title bar of the generated .chm file is incorrect and needs to be changed. I've set the project title using File->Project settings, and regenerated the .chm file, but its title bar still has the old text. Is there some other setting I need to make or file I need to rename or delete to get this to work? I'd really like to have the help file reflect the current product name, rather than the old brand...
Never mind; found it under Project Setup->Windows->HtmlHelp.
I am working on xcode4 and created a Settings.bundle for my project. I can edit the Root.plist file in xcode4 but it is not possible to edit the Root.strings file. It isn't even displayed in the editor.
I can not expand the en.lproj folder as you see in the picture.
But when I do right-click, open in external editor it gives me:
Double click on Root.strings gives me:
I tried it several times, creating a new window-based application project and creating a new Settings.bundle. I always can not localize it. Any ideas?
In XCode 4.2 you have to follow this steps (just a modification of Xcode 3.2.2 and localization of Settings.bundle)
Reveal your Settings.bundle in Finder.
Right click (or Ctrl-click) on it and select Show Package contents.
Create a new folder called as the desired language (e.g., fr.lproj).
Copy the Root.strings file from the en.lproj folder and paste in fr.lproj folder.
EDIT: Apple fixed, once again, the wrong bug. Their change rendered my workaround useless. It just doesn't work anymore, you can't add files to the Settings.bundle.
Please refer to the answer of Javi for a method that seems to work.
I hope you like ugly workarounds.
Right click on the settings bundle in the side bar.
Select New File
Pick Resource / Strings file
Name it Root.strings, make sure it is placed inside settings.bundle
In the side bar the file will be visible twice. In the "root" section, and in the Settings.bundle. But both point to the same files.
Select the Root.strings file in the root section. (AFAIR you have to convert it to UTF16)
Add localization, xcode will ask you if you want to replace the file. Yes, you want this.
Add as much localizations as you want. You should be able to edit the file in the root section of the sidebar.
I hope this works for you, for me it does.
And if you haven't done it please report the bug at bugreport.apple.com
I'll install the new release now, let's see if this is fixed. Edit: Not fixed.
EDIT: I don't know If I understood your second question correctly. But when you add a localization to the file that appears outside of the bundle it adds a localization folder to the settings.bundle
After adding spanish localization to Root.strings:
The actual file is in the foo.lproj folder, it just doesn't show them in the xcode sidebar. If you check the location in the file system you'll see they are inside the settings bundle.
Yesterday I checked with a english and german file and it worked correctly in the simulator. I guess it's just a wrong sidebar layout. The underlying locations and the handling of the files seems correct.
For me it worked to change the File Type (in the File Inspector) of the Folder "en.lproj" from "Default / Directory" to "Directory". Magic.
Xcode 4 is creating the "Root.strings" as a binary property list. so what I had to do was set the file type to "Property List (binary)" for it to show up correctly.
I have just given up trying to do something with Root.strings. Instead, I just copied the plist into each *.lproj, and it worked!
As far as this is about translation into English and my native language, no problem.
So I have:
Settings.bundle
|- en.lproj
| |- Root.plist
| `- Root.strings -- nothing useful there
|
`- zz.proj
`- Root.plist
The good news is that Root.plist is utf8.
If you already have a Root.strings file that is a "Property List (binary)" and you wish to convert it to a proper text-based strings file, you can use plutil in the Terminal application to convert it, for instance into JSON format:
> plutil -convert json /path/to/Settings.bundle/en.lproj/Root.strings
N.B. You can run plutil -h for usage help.
However, you will then need to convert the JSON format:
{"key1":"value1","key2":"value2"}
to that of a strings file:
"key1" = "value1";
"key2" = "value2";
This is easily done with a few search/replace operations in a text editor.