PIXEL
DOCK

I like the smell of Swift in the morning…

Build an ad hoc distribution .ipa file for a project that includes static libraries (e.g. Open Ears)

Posted: | Author: | Filed under: iOS, Xcode | Tags: | No Comments »

When I wanted to generate an .ipa file for my latest project I ran into the following problem: my project uses the Open Ears library for speech recognition. Open Ears is included as a static library. When I tried to archive the app to share it with others I could not create the .ipa file. After clicking on “share” the option to save it as an .ipa file was grayed out with the message “No Packager exists for the type of archive”. So no chance to build the necessary .ipa file that is needed for ad hoc distribution.

The solution for this problem is quite simple but it took me some time to find it. The problem is that you have to make sure that the static libraries are included in the application binary. You achieve this by setting the “Skip Install” build setting to “YES” for the libraries: Right click on the library project icon (the blue one) and find the “Skip Install” property in the “Deployment category” in the build settings. Set it to “YES”.

Important: leave the “Skip Install” property of your main project at “NO”.

When you archive your project now, it should offer the save as .ipa option in the share section.

Xcode: Dividing long NSString constants over multiple lines

Posted: | Author: | Filed under: Objective-C, Xcode | Tags: | No Comments »

Just a little Objective-C “trick” to make long NSString constants a little bit more readable in your Code:

To break a part of the long string to a new line you have to wrap it in quotation marks. The compiler will then put it back together to one long string.

So instead of doing this:

You could do this:

Of course the cleanest thing to do would be to separate the html code completely from your Objective-C code by putting it into a separate HTML file and load that into a string. But hey, who wants to be perferct all the time?

How to find an iPhone / iPad’s Document folder in Xcode

Posted: | Author: | Filed under: iOS, Xcode | Tags: , | No Comments »

Sometimes during development when you are writing or reading files from the Documents folder of an iOS Device it is quite useful to have a look at the devices filesystem. Or to the sandboxed Documents Folder of your app to be precise.

Here’s how you do it:

1. Developing on the Simulator

If you are using the iPhone / iPad Simulator for Development, the Documents folder is stored on your Mac’s harddrive:

/Users/user/Library/Application Support/iPhone Simulator/User/Applications/E599AF8C-D765-41A8-B593-A05D242CB701/Documents

You can also find the contents of the app’s “tmp” folder and the app’s preferences in the folder with the long and cryptic name. The only problem is to figure out what cryptic folder belongs to the current version of your app, because Xcode adds a new cryptic folder everytime you build your app in the simulator. So you probably have to find the right folder by looking at the folder’s timestamp.

2. Developing on the Device

Sometimes you have to use a “real” Device for Development. For example if you are using the iTunes File Sharing Feature which does not work on the Simulator. To find the device’s Document Folder for your app, follow this steps:

Xcode 3

  1. Open the Organizer Window in Xcode.
  2. Mark your Device in the left Column.
  3. Find your App in the “Applications” section on the bottom right.
  4. Click on the little triangle left of your App’s name.
  5. Drag the “Application Data” Bundle to your Desktop (or download it by clicking on the black arrow on the right)
  6. Open the downloaded folder (named something like: “com.yourcompany.appname 2011-02-24 10.50.14.277”) to find the Document Folder

Xcode 4

  1. Open the Organizer Window in Xcode.
  2. Mark your Device in the left Column.
  3. Click on “Applications” below your device (you might have to click on your device’s disclosure triangle to see these rows)
  4. On the right side you will see a list of your apps that are installed on this device.
  5. Click on your app’s “Download” Button
  6. Specify a save location and a folder containing your apps document folder will be saved.