Archive for the 'xCode' Category

07 SepA successful way of supporting multiple builds

This post describes how we support multiple builds. Most-often you need this if you work for enterprise or release own product line.

We follow these notes to add new builds to one product which has multiple targets/builds. The product is one Xcode4 project. Each build may have own graphics for a customer and may have some special settings like server settings via preprocessor and user-defined variables.

How to Make a New Build

  1. Copy existing Target – select main project file and find targets sections, then duplicate by right click menu
  2. Rename target according to customer name
  3. Remove and recreate Scheme – goto “Product > Manage Schemes …”, finds your’s and remove it, it usually looks like “copy of Main Build”; then press “Autocreate Schemes Now”
  4. Rename *.plist file, change its name in Target settings, check if *.plist file has “Relative to Project” Location in file settings in File Inspector on the right side of Xcode
  5. Add necessary Icons, Splash screens and graphics to the project

Not obvious, but quite easy. I’d not publish this note if it’s so simple. We faced to problems that prolong this process from 10 minutes to about 30–40 minutes.

That’s why I want to give you a list of notes that makes things solved faster by reading this:

  • When splash screens are not shown it’s need to check names. For example for product name of customer-X we have ProductX target/build: “ProductX-Default.png” – is right settings for iPad in *.plist, but file names are “ProductX-Default-Landscape~ipad.png” and “ProductX-Default-Portrait~ipad.png”. They’re recognized automatically.
  • Entitlements file must be written with its extension – “Entitlements.plist” – in the Target settings
  • Files like *.plist must have according Target membership settings – look at File Inspector “Target Mambership” section.
  • Location of files must have “Relative to Project” but NOT something like “Absolute”. It’d be a problem when you share project code.
  • ${EXECUTABLE_NAME} settings must be present in *.plist file. Other way app just doesn’t run and nobody knows why
  • if on launch you see Running or Attaching and nothing is happening, it’s better to remove your user settings inside Project File. Do it carefully by right clicking on project file in Finder then press “Show Package Contents” and find your name inside “xcuserdata” directory. Remove yours subdirectory and run cleaned project again. If it’s helped then it means the EXECUTABLE_NAME settings wasn’t renamed while you copying Target and Xcode was waiting for wrong EXECUTABLE_NAME to be launch. Good if it works now.

I’d very recommend to go through the list if you have really strange or unclear problem.

Happy building! :)

29 JaniOS BetaBuilder & Dropbox – the fastest adhoc distribution ever

Add caption

The first version of iOS BetaBuilder was released months ago. It seemed good but not very attractive or very actual at the moment.

Time changes. ©

This week I am wondered each time I release AdHoc IPA to show customers, partners or friends to test. I wonder like a child to a brand-new toy. I found that I want to use it more and more. I’d say it motivates to produce more results comparing to old way to distribute with magic passes like it was in 2009.

Simplicity inspires. ©

So I’d like to say a big THANKS to developers. They really:

iOS BetaBuilder current version is 1.5 (download it).


Generate an IPA and save it to disk

To contribute something to this topic I’d like to share my method of “generate AdHoc in 30 seconds”. First of all we need to make usual steps to generate an IPA and save it to disk. Usually it takes 10–15 seconds, but very depends of an application size.

It’s a kind of trick to use the Dropbox as a hosting, so open Dropbox public folder. Then create subfolder with a tiny file inside to get a Dropbox public URL for the subfolder. Mine is “http://dl.dropbox.com/u/2334198/test%20for%20the%20blog/”.
  1. open target project
  2. select Device and AdHoc as a build configuration
  3. press Build and Archive to create the adHoc IPA file
  4. when it’s built go to the Xcode Orginzer by pressing Ctrl+Cmd+O
  5. at the left find target application name and press Share button
  6. select right provision profile and press “Save to disk”
I save IPA file to the same Dropbox subfolder. iOS BetaBuilder will show you a warning later, but it doesn’t matter. It copies the same IPA to this folder anyway. Now we have an IPA file, so it’s time for the star on the scene.
Generate Deployment Files
Finally:
  1. open the BetaBuilder
  2. select the IPA file
  3. if ”Full Web Development Path” is empty then past the folder’s Dropbox public URL to it
  4. press “Generate Deployment Files” to that dropbox subfolder
Now share a public link of the “index.html” in the public subfolder. Beta testers should open the link on any iOS device and drectly isntall it throught the web. Not iTunes in this process – magic!

Yes, I know it looks difficult, but after 2 times it will take untill 30 seconds to share an AdHoc. It rocks! Don’t believe me, but just try your self!

29 JulHelpful primitive #DEFINEs I really like

#define cgp(x,y) CGPointMake(x,y)#define cgpz CGPointMake(0,0)
#define cgf(x,y,w,h) CGRectMake(x,y,w,h)

#define NUM(i) [NSNumber numberWithInt:i]#define NUMF(f) [NSNumber numberWithFloat:
f]// etc if you need, I don’t// this one is MUST HAVE EVER#define IMG(name)
[UIImage imageNamed:name]#define NSTR(patern, value) [NSString stringWithFormat:patern,
value]#define NSTR2(patern, value1, value2) [NSString stringWithFormat:
patern, value1, value2]#define INT2STR(i) [NSString stringWithFormat:@"%d",
i]#define FLT2STR(i) [NSString stringWithFormat:@"%0.2f", f]// etc if you needThe most important reason not to use #DEFINE is code readability, imho. Everyone can define own abbriveations and then get dead code. I mean not an Unreachable code, but code that nobody else can support effectively, even an author after months left. It’s easy to get addicted and generate shorteners for every partially doubled line.

That’s why I propose only helpful #defines I use almost in every project. They look very simple and even obvious. I place them in the precomiled *.pch file to be availabe in all sources.

This helps with coordinates:

This helps with string creation and constants:

Other small objects:

There are 10 more for subviews creation, but it’s more like an approach than promitive shortneners. I’ll describe that later with samples.

I’ve googled a little and there are some nice links on that:

I suppose it helps begginers only. Others can write their experience in comments.

16 MarIcon.png, Default.png and Resources problem using several Target settings

There is can a problem with resources when you use several target for your project. So if you’ve added the Icon.png or Default.png or some other resource file and the app does not show it then select the resource and move it to Targets/aTarget/Copy Bundle Resources. Trust me, it helps.

BTW, you cannot I don’t know how to set different Default.png(s) for each target, so rename them when necessary.