I'm an independent developer working primarily with iPhone applications, and I'm currently engaged in several different projects. Some are for myself, and others are for one of a number of clients. Because of this, I'd like to have a way to have Xcode set the copyright notice at the top of each source file on a per-project basis.
I've seen these questions, and I understand that Xcode by default pulls the organization on the user's Address Book contact card for the copyright statement, and that you can change the property either in the Address Book or on the terminal. What I'm looking for is a setting that lets that default be changed for each project, and has Xcode remember the copyright assignee (i.e. I don't want to have to change my Address Book organization entry each time I switch projects).
You can change the organization Xcode currently uses by issuing the following command in Terminal:
defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ORGANIZATIONNAME = "Some Company Name"; }'
You can then create scripts that switch the current company for Xcode.
Upgrade to Xcode 3.2, which now has a project setting for organization name.
You might want to make custom templates. Have a look at this question:
Change templates in Xcode
look in text macros section:
Change the text used for the header of a new file by setting the value of the FILEHEADER text macro.
The example shows the default definition for the macro. Other macros are included in the definition by including three underscore (___) characters before and after the name of the macro. The line with COPYRIGHT is included only if an organization name is set.
// ___FILENAME___
// ___PACKAGENAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
Related
Is there a way to show only the month and year(i'm validating credit card expiration) without changing the source code of the toolkit when using the DatePicker?
I know I'm a bit late now but recently I ran into the same problem. Fortunately, I have the answer to your question ;-)
Here is how we accomplish what we want: we take the DatePicker from the Windows Phone toolkit and create a modified copy of all necessary files.
Step 1: Create a modified copy of DateTimePickerPageBase and a copy of all DataSources. Simply create a file "DateTimePickerPageBase.cs" and replace its content with the one here: http://pastebin.com/wJkYrdGX.
Step 2: We have to create the page which is to displayed. Therefore, create a new "Windows Phone Page". Replace the content of the XAML-file with the one here: http://pastebin.com/Ah8CkRD9. Then, replace the content of the .xaml.cs file with the one here: http://pastebin.com/UsHnLXs7.
Step 3: If we want to use this modified DatePicker, we simply have to add the following XAML to our view:
<toolkit:DatePicker PickerPageUri="/MonthYearPicker.xaml ValueStringFormat="{}{0:y}"/>
Note: You might change the path according to the path of our xaml-file created in step 2.
Note: You might change "toolkit" to the namespace-name where you included the Windows Phone toolkit.
Hope it helps ;-)
I have built a generic application which can handle different content data - but for each content data, it will be a different iphone application (with a different name).
I would like of couse to only keep one code base for all these different apps (as it would be easier maintenance) but I have 2 questions:
1- I would need to change the appname in the buildsettings, etc.. and may be it is going to be an overkill...? especially with the upload process then...? What are your experiences in that domain and what would you recommend me to do?
2- how can I have all the pictures for logo (Icon.png, etc...) to co-exist into one app? For the moment, I have a global variable (as a singleton pattern) that I switch to change appname and loaded data inside the program
Thanks in advance for your help
Cheers,
geebee
You can do this pretty easily, it's what most developers do in their lite versions. All you have to do is add another target to create a new app out of the same code and use that global variable.
In order to change the images included in the app you simply edit the target and under the copy bundle resources menu remove the unnecessary resources. You'll notice that when you add a new resource you have the option to include it in any one or more of your targets. Simply select the one that you want and it will only be accessible to that target.
The reason that this works is that each target can have its very own info.plist. All the settings and resources can be separate, and the code can be different using your #ifdef global_var.
Here's a slightly outdated tutorial that should get you started if you need it.
http://www.bit-101.com/blog/?p=2098
For each application name add one target.
Create one xyz-info.plist for each of the target. (in this case for the xyz.app)
In each of the xyz-info.plist assign the appropriate icon files etc.
Within your build phases for each of the targets you will define which images go with which app.
I'm using Eclipse (v3.5.2 to be exact), and the several of the plugins I'm using use the {user} field to populate various things (for instance, Egit puts the username and email address in commits, and the StatEt plugin for R puts the username as the Authour tags in roxygen Rd doc files.)
However, On my system my username is meaningless to anyone outside of the company. Is it possible to change this field to something more sensible like "Paul Hurley" (and similarly to set an email address), either manually, via a configuration or via some script on load ?
I always modify some eclipse settings in ECLIPSE_HOME\eclipse.ini file.
-Duser.country=EN
-Duser.language=en
-Duser.name=Matthieu BROUILLARD [matthieu#somewhere.org]
Overriding those properties is very usefull especially for bad translation in your local language. For me for example SVN plugins are really difficult to use with french translation.
Hope this helps.
What I am trying to achieve is for the application icon to be different in builds that I send out to my beta testers, to that of the application that will be submitted for approval. This will allow me and my beta testers to easily identify the app is a beta version.
I was not sure if I should be adding a build script to modify the info.plist and change the application icon specified there. For this I guess I would have to conditional check the build type (DEBUG/RELEASE/DISTRIBUTION etc) and write the appropriate value to the plist file.
Alternatively I thought I might need to create a separate target for beta releases and specify the new BETA application icon there.
If anyone has done this kind of procedure before, any tips and ideas about how best to do it would be very much appreciated.
Outdated: As of September 2017, my answer is probably outdated now. Please use latest Apple developer guides relating to Asset Catalogs. Asset Catalogs are the new way of specifying image/icon resources for your app.
Original answer:
Both ways you have mentioned can be used for this purpose (Through a separate Target or using Build settings). In my opinion, the more logical way would be to use a different build configuration and set the plist file to dynamically get the icon file name from the build configuration.
Here is how I would do it:
In project build settings, create a new user-defined variable called ICON_FILE (for "All Configurations")
Set the value of the variable to "Icon.png" (for "All Configurations")
Create a new build Configuration called "Beta".
Set the value of the ICON_FILE variable to "Icon-beta.png" for "Beta" configuration.
(this will make all the configurations have the value "Icon.png" except Beta config)
In the Info.plist set the value of "Icon file" attribute to ${ICON_FILE}. This will make the info.plist dynamically get the filename from the variable you defined earlier.
In your application resources, include the beta icon with the name "Icon-beta.png" in addition to "Icon.png" you already have.
If you build the app using "Beta" config, the app will have the beta icon as the app icon.
Hope this helps!
Asset catalogs can be used without creating another target.
Here are the steps I use:
1 - Create two (or more) app icon set in images.xcassets
2 - Create another configuration from project settings
3 - Go to Target -> Build Settings and search for app icon.
You will see Asset Catalog App Icon Set Name under Asset Catalog Compiler - Options. Change the asset catalog name that will be used in new configuration.
4 - Build for different configurations.
The accepted answer is not working for xcassets.
So, if you already started to use xcassets catalog here is the steps:
You need to create 2 different targets of your application.
To do this:
Right click on your target. -> Click Duplicate (or Cmd+D)
Set name of new target like MyApp-beta
Create separate icon:
Go to your xcasset catalog.
Right click on column with list of images -> click New App Icon
Name it like icon-beta, add place here your beta icons
Click on your beta-target
Go to tab General -> App Icons -> select your asset icon-beta
Here it is. Now you can build your beta application!
Another advantage of this method over that described in the accepted answer - is that you can install both versions at the same time of your Application. (you need to set different Bundle Identifier for this).
When we add a new file,
In .h & .m file, there is always a comments/documentation section at top.
example.
//
// SimpleGameAppDelegate.m
// SimpleGame
//
// Created by hbmac2 on 01/10/09.
// Copyright __MyCompanyName__ 2009. All rights reserved.
//
Here, there is by default hbmac2 - is user name & MyComapnyName is also default.
Can't we set it like,
Created by Sagar -
HiddenBrains.com - by default?
Can we set any other comments to be there by default?
Nall's answer is good, but you should know that in Snow Leopard XCode you can set the Organization name (the name used by the templates) in the General tab of project settings.
If you are working on only your own stuff, you should set it once via the other means. If you are working for clients you should use the per-project setting so a file always gets the right name as you switch between projects.
1) In 3.0 and later, set your Company Name in your personal Address Book card.
2) In 3.2 and later, you can additionally have a per-project Company Name set in the Project's General tab in Get Info.
See this question for copyright: Setting copyright statement on a per-project basis?
See this question for templates: Change templates in Xcode
Another one: XCode: What do I have to type into the Terminal, in order to change the copyright notice in code templates?