{"id":102,"date":"2010-02-10T00:55:17","date_gmt":"2010-02-10T05:55:17","guid":{"rendered":"http:\/\/developer.casgrain.com\/?p=102"},"modified":"2010-02-10T00:55:18","modified_gmt":"2010-02-10T05:55:18","slug":"multiple-developers-one-iphone-app","status":"publish","type":"post","link":"https:\/\/developer.casgrain.com\/?p=102","title":{"rendered":"Multiple developers, one iPhone app"},"content":{"rendered":"<p>I am working on an iPhone project with seven other iPhone developers, and we all have individual development certficates (the project did not require a group certificate, and we all had ours already).<\/p>\n<p>\nSince one has to sign code to run outside the simulator, we all edited the Info.plist&#8217;s Bundle Identifier to match our certificates (mine was <code>com.casgrain<\/code>, as you can guess).<\/p>\n<p>\nThis leads to a permanently-modified file in your local copy of the source repository, one that you have to ensure you do not commit. It&#8217;s not very neat, and it is error-prone. And if you want to genuinely modifiy the plist, you must discard your changes, do the modification, commit and re-do your changes. Not pleasant.<\/p>\n<p>\nI wanted to use plist pre-processing to solve this issue, since it will replace environemnt variables in the plist before using it, for instance to sign code.<\/p>\n<p>\nThe goal is to replace this:<\/p>\n<pre>\n\t<key>CFBundleIdentifier<\/key>\n\t<string>com.myCompany.${PRODUCT_NAME:rfc1034identifier}<\/string>\n<\/pre>\n<p>with this:<\/p>\n<pre>\n\t<key>CFBundleIdentifier<\/key>\n\t<string>${DEVELOPER_DOMAIN}.${PRODUCT_NAME:rfc1034identifier}<\/string>\n<\/pre>\n<p>Pre-processing supports environment variables, but not any environment variable. If you define a variable in <code>~\/.profile<\/code> (if you use bash or a bash-compatible shell), this does not work.<br \/>\nYou have to define the variable in <code>~\/.MacOSX\/environment.plist<\/code>, a special plist that is read at login time.<\/p>\n<p>\nTo define this variable, follow these three simple tasks in Terminal. You only need to do them once.<\/p>\n<ol>\n<li>Create the `\/MacOSX folder if it does not exist. If it is already present, this is harmless\n<pre>\n\tmkdir ~\/.MacOSX\n<\/pre>\n<\/li>\n<li>Add the environment variable\n<pre>\n\tdefaults write ~\/.MacOSX\/environment DEVELOPER_DOMAIN -string \"com.yourdomain\"\n<\/pre>\n<\/li>\n<li>Ensure that the plist is human-readable and not compressed XML, in case you want to edit it later with a text editor\n<pre>\n\tplutil -convert xml1 ~\/.MacOSX\/environment.plist\n<\/pre>\n<\/li>\n<\/ol>\n<p><em>You will need to log out and back in for those changes to take effect.<\/em><\/p>\n<p>\nNow, do the repkacement above in your Info.plist, substituting &#8220;<code>${DEVELOPER_DOMAIN}<\/code>&#8221; for &#8220;<code>com.myCompany<\/code>&#8221; or whatever the reverse-domain was for your project.<\/p>\n<p>\nWith this modification, you should now be able to build for the device without changing the plist every time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am working on an iPhone project with seven other iPhone developers, and we all have individual development certficates (the project did not require a group certificate, and we all had ours already). Since one has to sign code to run outside the simulator, we all edited the Info.plist&#8217;s Bundle Identifier to match our certificates [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-development"],"_links":{"self":[{"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=102"}],"version-history":[{"count":1,"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/posts\/102\/revisions"}],"predecessor-version":[{"id":103,"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/posts\/102\/revisions\/103"}],"wp:attachment":[{"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.casgrain.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}