• Singeltons made simple

    In my quest to adopt the new ARC technique introduced with Xcode 4.2 I needed to find a good way to implement the Singelton pattern. The way I did it previously involved overriding methods like retain and release, something that is strongly discouraged in ARC.

    The solution I settled with was an extremely simple but effective one and needed only a single method (found on the internet).

    + (id)sharedInstance
    {
        static dispatch_once_t _predicate = 0;
        static id _sharedInstance = nil;
        dispatch_once(&_predicate, ^{
            _sharedInstance = [[self alloc] init];
        });
        return _sharedInstance;
    }
    

    That’s all that is needed. But even if it’s very neat it’s not fool proof and it’s still possible to create new instances of the object. But for my needs this is the perfect solution.


  • How to use Apples Reachability.m in Xcode 4.2

    When I tried to build a new version of a project using Apples Reachability.m code in Xcode 4.2 I got some annoying warnings that wasn’t there before. Since I’m not very fond of releasing an app that I know contains compiler errors I knew I had to find a solution to this.

    The solution was to add the following line to Reachability.h:

    #import <netinet/in.h>

    Not really sure why this is needed in 4.2 and not in the earlier versions, but the struct sockaddr_in that is the cause of the warning is declared in that header file.

    Anyway, this removed the warnings and the app both compiles and runs fine.


  • Vi på Vega

    During my summer vaccation I spent some time developing an app that I really needed. It’s an app for my sons school, Vegaskolan in Vännäs.

    It contains a Swedish calendar including week number, date and the name of the day. It also displays the current weather report, what’s served for lunch and a notification for upcoming holidays.

    You can also find all phone numbers that you may need to contact Vegaskolan.

    You can find the app here: http://itunes.com/apps/vipavega


  • Wishes in your pocket 1.1.0

    A new version of Wishes in your pocket (1.1.0) is now available on app store. Here are the main new features:

    • Add an image to a wish. Use the camera to take a photo or pick an image from the album.
    • Export one or more wish lists and mail the exported file to someone else with an iPhone and the Wishes app. The reciever can then just open the attached file and get the wishlists imported automatic.
    • HTML-formatted mail when mailing a wish list. With the posibility to select what fields shoul dbe included in the mail.

    Get it here!


  • Now available on app store!

    The first version of my very first app, Wishes in your pocket is now available through app store!

    Get it here!

    I submitted the release to Apple on december 6 and on december 15 it became available.

    Unfortunately I found a minor bug in v1.0 that prevents the start-up screen from showing. This doesn’t affect the functionality of the app but will cause a black screen to show during start-up. This bug didn’t show in any tests but apparently only appears when installing the app from app store. An update (v1.0.1) to fix this is on it’s way!

    I’ve also already started to work with v1.1 that will contain some brand new features. The main new feature will be the ability to add an image to a wish but a few other goodies is also planned to be included.


  • First app submitted to App Store!

    I’ve just submitted my very first iPhone app, Wishes in your pocket to App Store for approval!

    This completes the first part of my journey as an iPhone developer. It began some months ago when I got my iPhone 4 and bought my very first Apple computer, an iMac.

    Now I will have to keep my fingers crossed that it will make it through the review process. Did you know how hard it is to type on the keyboard while keeping your fingers crossed? You should try it :)

    But if it shouldn’t get approved, well that’s something to learn from to!

    Time for bed! If I can get any sleep now, that is.


  • A new adventure!

    Welcome to http://iphone.arainyday.se!

    This is a sister site of my main website http://arainyday.se where I usually post all my different projects. On this site I will post news about my iPhone adventures. I’ll also try to write some small tutorials based upon my experiences learning iOS development.

    I’ve coded all my life and I have learned many computer languages and used them on many platforms but coding Objective-C for iOS is more fun than I’ve had in years!

    Coding Objective-C is something like travel back in time a little but still not. Objective-C is based on C (just as C++) but with the advantages of having some really good and modern frameworks to use. And together with all features in Xcode it’s a really smooth ride. Apple is also really good when it comes to documentation. API documentation, code samples, guidelines and tutorials can all be found at http://developer.apple.com. Even the somewhat awkward process of handling certificates and provisional profiles is really well documented with both text and video.

    Developing for the iOS platform is a really interesting challenge and my experiences has so far has been nothing but pleasant!

    Coding is fun again!