Load Interface Inspector's framework without modifying your Xcode project
Along the lines of Oliver Jones' great tip about loading Reveal App's* library into your iOS app without restarting the app or modifying your Xcode project, loading Interface Inspector's** library into your Mac app at runtime is even easier thanks to Framework Bundles***. Simply add this into your .lldbinit:
command alias interface_inspector p (BOOL)[[NSBundle bundleWithPath:@"/Applications/Interface Inspector.app/Contents/Resources/InterfaceInspectorRemote.framework"] load]
and now at your lldb prompt just type "interface_inspector" (or some unique part of that followed by tab) and then continue and you'll be up and running.
* If you've been living in a cave you may not know about Reveal - the best thing for iOS developers since iOS 2.0.
** Interface Inspector is like Reveal for Mac apps (except not as good of course! No complaints about Interface Inspector, but you have to back your friends ;)
*** If you're thinking "why can't it be this easy on iOS?" - read Landon Fuller's excellent post: iOS Static Libraries Are, Like, Really Bad, And Stuff (Radar 15800975) and dupe his radar :)
GNUstep bleeding edge
For a client project I'm looking into Mac/Linux GUI cross platform options. Naturally GNUstep is high on my list. It's been a while (maybe 10 years) since I even played with GNUstep and I've struggled a bit getting all the latest things to compile together. So, like everyone else, I'm putting together a guide for how I did it since none of the other guides seem to be up to date (and I'm sure mine will be out of date shortly too!)
I'm installing on Ubuntu 12.04, but other Linux platforms will be very similar - just the dependencies might be different.
So firstly about those package dependencies. I've done so many apt-get installs that I've lost track exactly what I needed. Something a bit like this:
sudo aptitude install build-essential git subversion ninja cmake libffi-dev libxml2-dev libgnutls-dev libicu-dev libblocksruntime-dev libkqueue-dev libpthread-workqueue-dev autoconf libtool
Make sure you've uninstalled any older clang or libobjc libraries (otherwise you'll need to be very careful with configure args etc. to specify our compiled versions) and also any older version of libdispatch
Firstly we want the trunk version of llvm/clang. Grit your teeth, because we're going to have to use subversion:
Now add the following to your .bashrc etc:
Now reload your bashrc:
Check you can find clang:
Now we want the latest gnustep libobjc2 with all the latest modern runtime goodies:
Now add the following to your .bashrc:
export OBJCFLAGS="-fblocks -fobjc-runtime=gnustep"
Now add the following to your .bashrc:
Now we can start installing gnustep itself:
If you get warnings about blocks during make, check that you don't have old libobjc libraries on your system. You can specify a particular libobjc library version when you build the gnustep-make package, but easier to just uninstall them.
Now lets run some tests.
The gnustep-base check tests are very handy for making sure you have all the latest things. Warnings you should look out for are things like you haven't enabled blocks or subscripting. If you get warnings like that you should check your OBJCFLAGS etc. At this point I get no failures or skips:
Now we want the latest lib dispatch for all our GCD goodness:
Now we can compile some test code from this post (http://lists.gnu.org/archive/html/discuss-gnustep/2012-12/msg00036.html) which I have pasted into a gist: https://gist.github.com/aufflick/5674798
And there we are! Ready to install the other gnustep-* modules from github.
AQXMLParser + OAuth
I've been enjoying using Jim Dovey's excellent AQXMLParser lately, and in fact am giving a talk on it tonight at Sydney CocoaHeads. To use it in a new project, I need to be able to authorise the outbound REST request with some OAuth 1 tokens etc.
OAuth can be a right pain, and the Cocoa implementations aren't awesome. gtm-oauth (the OAuth 1 library from the Google Toolbox for Mac) is a little odd in its implementation, but doing your own OAuth implementation would be so tedious it's one of the better options out there.
It's all pretty easy. Firstly, use gtm-oauth like normal to have your user authorise your app and receive a token.
Next, to make a request, gtm-oauth provides a way to authorise an NSMutableURLRequest, but AQXMLParser uses it's own HTTPMessage class (which wraps the lower level CFHTTPMessage from Core Foundation).
What I have done is extend HTTPMessage to provide a copy of itself as an NSURLRequest, and then write a category that auths that with gtm-oauth and then cribs the headers from that and applies them to the HTTPMessage. It's a little roundabout, but because of the need to sign the whole request and the way that gtm-oauth internals work, anything else would be very complicated. So in use, it looks like this:
For now the changes and category are only in my fork, but I have a pending pull request with Jim that I will work out the best way to incorporate them into his master repository. My fork also contains tweaks to work with the latest llvm and ARC (although note neither gtm-oauth nor HTTPMessage or AQXMLParser use ARC, so you'll have to add the -fno-objc-arc compiler flag where appropriate).
My fork of aqtoolkit: https://github.com/aufflick/aqtoolkit