Showing posts with label ios. Show all posts
Showing posts with label ios. Show all posts

Monday, October 12, 2015

What I've learnt today


Here is a list of things I have learnt today. Things to remember for myself and to reflect on.
  1. AppCode has a simple, yet very useful CocoaPods integration. Easily create a podfile and fill in your dependencies. AppCode will provide you with a button to install your dependencies. Bonus: if you remove a dependency from your podfile, AppCode will give the uninstall button. Keeps your project directory neat and tidy. You can do this on the command line too, but it fits perfectly into the IDE.
  2. Swift playground in XCode 7.0.1 on El Capitan 10.11 sucks! I had so many crashes in the playground, that I had to restart XCode several times to get it back working.
  3. Swift and Objective-C seem to have a "Love and Hate" relationship? Why, you might ask? I tried to use some library that was written in Objective-C with my Swift project. It took a good amount of work to navigate around those little compile errors and find alternative ways to use the library anyways. But it was painful and not fun at all. What I did? I created a custom XML deserializer for Alamofire with Ono.

Monday, February 11, 2013

List all available instruments templates

Using Apple's instruments on the command line to inspect an iOS application on the device, usually involves a specific template to capture data from the application running on the device.

For my current project I usually used the Automation.tracetemplate to launch my iOS app. But after I've upgraded Xcode from 4.3 to 4.5, the filesystem location of the instruments templates have been slightly changed. The framework that I wrote for the performance tracking system failed in finding the template. I started to investigate a better solution to be able to deal with different Xcode versions that could be found on the dev machines.

For that reason I created a little helper class to identify the version of Xcode to locate the correct path of the Automation.tracetemplate. That works pretty fine, but I don't know if this will work for future Xcode versions too. This solution required xcodebuild -version to determine the Xcode version and xcode-select -print-path to determine the location of the Xcode folder. I needed this information to assemble the path to the templates.
There must be a better, shorter way of getting this information.

A better solution

Running instruments on the command line produces a rather concise than helpful overview of the available options. I couldn't find any manpage for instruments on my machine. Rather by accident than intentional, I came across the instruments manpage on Apple's Developer Connection website.

The manpage contained far more information about the available options including some description for the unknowing user. I discovered the option -s that produces a list of all available instrument templates.  Even if the manpage was targeting the Xcode tools 3.2.5 version (I couldn't find a more recent version), the option is still recognized by the latest instruments (as time of writing I used Xcode 4.6).

Running instruments -s and parsing the output will give me path to the Automation.template. without any guessing or probing. I hope this option will remain available in instruments in future versions.