Cocoa

Enabling Dwarf DSYM Debug Information Format in Xcode

Posted in | »

Enabling Dwarf DSYM debugging brings a number of benefits as listed in http://developer.apple.com/tools/xcode/symbolizingcrashdumps.html.

Most developers will have Xcode's debug build configuration set up to build for the local architecture will all the deployment options firmly disabled.

When building for release however we want to build for all architectures, we may want the deployment options on and may wish to extract our debug symbols into separate DSYM files.

Submitted by Jonathan Mitchell on Tue, 08/18/2009 - 13:37

How to Crash a Cocoa App for Testing Purposes (aka Abnormal Termination on Demand)

Posted in | »

Sometimes you need to crash your Cocoa app to analyse its crash behaviour.

Apple offers some guidance on this http://developer.apple.com/tools/xcode/symbolizingcrashdumps.html

#define CRASH_CODE 1
#if CRASH_CODE
	(void)strlen((const char *)1);
#endif

On Leopard with Xcode 3.1.3 and GCC 4.2 it seems that something more is required.

The most reliable way to ensure abnormal termination is courtesy of stdlib.h:

abort(); 

Submitted by Jonathan Mitchell on Tue, 08/18/2009 - 13:13

Code Signing for Auxiliary Executables Causes SSL Error kCFStreamErrorDomainSSL

Posted in | »

KosmicTask utilises SSL/TLS to ensure the privacy of network communications.

The app also utilises code signing to gain seamless access to the keychain and to permit incoming communications to be routed through the application firewall (see http://developer.apple.com/technotes/tn2007/tn2206.html).

Debug builds of the application worked as expected and SSL communications were established and operative.

Building for release though was another story. SSL communications failed with error kCFStreamErrorDomainSSL code -9800 (Operation could not be completed).

Submitted by Jonathan Mitchell on Tue, 08/18/2009 - 10:09

A Very Simple NSNumberFormatter Currency Subclass

Posted in | »

NSNumberFormatter is the class of choice when formatting numeric input for text fields. If you choose to use a currency symbol prefix then the default behaviours can be less than ideal.

If the user inputs the currency symbol then all is well. If not (inputting say 1.50 instead of £1.50) then the formatter raises an error and the user is nagged that a formatting error has occurred.

A simple fix is to subclass NSNumberFormatter and add the missing currency symbol if it is missing. The modified string can then be forwarded to the base class.

Submitted by Jonathan Mitchell on Tue, 08/11/2009 - 13:46