Atlassian CI with Objective-C applications and TestFlightApp

In these times we don’t want to waste any time on endless build times and setting everything to deploy your build. Preferably we’d like to do this automatic. There are many different CI (Continuous Integration) platform like Atlassian, Jenkins, Xcode Bots, Hudson, etc.

Continuous Integration

Let start with a question: What is Continuous Integration exactly? Well for starters it saves you a lot of hassle with verifying your code. Of course we can run the test cases with XCTest or SenTesting Kit and test them locally but we could do this automatically. Especially when you’re working on a team it’s nice to know if someone commits a change to your repository that it actually works as it is intended to do, CI makes sure that this happens. Continue reading Atlassian CI with Objective-C applications and TestFlightApp

Show call stack

Ever wondered where call to a certain method came from? There is a very simple way to display the call stack including all the symbols of the executable.

To display this stack just log:

 

Convert .p12 to .pem for APNS

  1. Development Phase:

    Step 1: Create Certificate .pem from Certificate .p12
    Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12

    Step 2: Create Key .pem from Key .p12
    Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12

    Step 3: Optional (If you want to remove pass phrase asked in second step)
    Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem

    Step 4: Now we have to merge the Key .pem and Certificate .pem to get Development .pem needed for Push Notifications in Development Phase of App
    Command : cat apns-dev-cert.pem apns-dev-key-noenc.pem > apns-dev.pem (If 3rd step is performed )

    Command : cat apns-dev-cert.pem apns-dev-key.pem > apns-dev.pem (if not)

    Step 5: Check certificate validity and connectivity to APNS
    Command: openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apns-dev-cert.pem -key apns-dev-key.pem (If 3rd step is not performed )
    Command: openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apns-dev-cert.pem -key apns-dev-key-noenc.pem (If performed )

    Production Phase:

    Step 1: Create Certificate .pem from Certificate .p12
    Command: openssl pkcs12 -clcerts -nokeys -out apns-pro-cert.pem -in apns-pro-cert.p12

    Step 2: Create Key .pem from Key .p12
    Command : openssl pkcs12 -nocerts -out apns-pro-key.pem -in apns-pro-key.p12

    Step 3: Optional (If you want to remove pass phrase asked in second step)
    Command : openssl rsa -in apns-pro-key.pem -out apns-pro-key-noenc.pem

    Step 4: Now we have to merge the Key .pem and Certificate .pem to get Production .pem needed for Push Notifications in Production Phase of App
    Command : cat apns-pro-cert.pem apns-pro-key-noenc.pem > apns-pro.pem (If 3rd step is performed ) Command : cat apns-pro-cert.pem apns-pro-key.pem > apns-pro.pem (if not)

    Step 5: Check certificate validity and connectivity to APNS
    Command: openssl s_client -connect gateway.push.apple.com:2195 -cert apns-pro-cert.pem -key apns-pro-key.pem (If 3rd step is not performed )
    Command: openssl s_client -connect gateway.push.apple.com:2195 -cert apns-pro-cert.pem -key apns-pro-key-noenc.pem (If performed )

Static library from sub project in Xcode

Create a Workspace

  1. Under Xcode 4, go to File, New, Workspace.
  2. From Finder you can then drag in the .xcodeproj projects for both the static library you want to use, and the new app you are building that uses the library. See Apple Docs for more info on setting up Workspaces: http://developer.apple.com/library/ios/#featuredarticles/XcodeConcepts/Concept-Workspace.html

Static Library Project Settings

  1. Make sure all the static library’s headers are set to copy to “Public”. This is done under the settings for the static library target > Build Phases. In the “Copy Headers” phase, make sure all your headers are within the “Public” section.
  2. Next go to Build Settings, find “Public Headers Folder Path” and type in a path for your library. I choose to use this:

include/LibraryName

I’ve adopted this from use with RestKit and found it works best with all my static libraries. What this does is tells Xcode to copy all the headers we moved to the “Public” headers section in step 1 to the folder we specify here which resides within the Derived Data folder when building. Like with RestKit, I like using a single “include” folder to contain each static library I’m using in a project.

Continue reading Static library from sub project in Xcode