2012/11/06

With the update from iOS5 to iOS6 Apple changed the Captive Network Support, so that the option automatic Login in the WLAN / Wifi options is no longer available. After the Update to iOS6 it was impossible for me to login to my company WLAN / Wifi Access Point using my iPhone.
To get a workaround to this problem I wrote the App “Wlan Aid”. It uses the Captive Network Programming Interface. The only thing a User has to do is to put in the SSID of the WLAN he wants to join. Than the app calls the Function CNSetSupportedSSID with this SSID as input parameter. With this function my app registers the SSID with Captive Network Support, thereby assuming responsibility for authenticating with this network.
And that’s it. After my application has registered the SSID the web sheet of Captive Network Support is suppressed, and the user can complete the authentication in Safari. In Safari it is possible to accept any unauthorized certificate and so on.

2012/09/17

A class in Objective-C can declare two types of methods: instance methods and class methods. An instance method is a method that is triggered when a message is sent to a particular instance of the class. In other words, before you call an instance method, you must first create an instance of the class. Class methods, by comparison, do not require you to create an instance. They are triggered when a message is sent to a class. In other languages, i.e. Java, class methods are called static methods.

One common use for class methods in Objective C or static methods in Java is to provide utility methods, i.e mathematical functions. A common example for static methods in Java are the static methods in java.lang Math. In Objective C you can often rely on pure C functions for utility methods, such as mathematical functions, so that you won't find many utility class methods in the frameworks, i.e. the fondation framework.

In Objective C you typically use class methods as (static) factory methods to create new instances of the class, which is an alternative to the object allocation and initialization procedure. For example NSString contains some very useful factory methods (like + (id)StringWithFormat:(NSString *)format) that return autoreleased NSString objects.

One advantage of static factory methods is that, unlike constructors, they have names. A static factory with a well-chosen name is easier to use and the resulting client code easier to read.

Most of the factory
methods in the apple frameworks are good example for good naming convention as
you can see in NSDate. You don't need much documentation to understand which
objects are created by the following methods:

2012/09/11

In Xcode 4 when an exception is raised (wether it is ,unrecognized selector sent to instance‘ exception or an 'out of bounds' exception or another exception) the exception goes up the call stack looking for someone who can handle it. And what normally happens is that no on handles it and the exception percolate up the call stack all the way up to main. The program just crashes and you lost the call stack information.
To avoid this, Xcode provides a very important breakpoint which gonna break every time an exception is raised and Xcode shows in the main code window the line of code on which that exception would raise.

You can add an Exception Breakpoint by opening the Breakpoint Navigator.

Breakpoint Navigator

Than you have to click the Plus Button in bottom left corner:

Add Exception Breakpoint

After clicking Add Exception Breakpoint menu item, you will see this breakpoint configuration view open up:

Click Done

After clicking the Done button and you will the new Exception Breakpoint in your list of breakpoints.

I recommend setting that exception on all the time on in Xcode because you pretty much always want to have this exception happen right a the line of code.