Between Covid-19 and moving into a new house, it was finally time to setup a proper home office (I used to work at the kitchen table whenever I worked from home in the past which was not the most productive environment). I’m pretty happy with the result. The desk and chair are from UpliftDesk . There’s plenty of light coming from the window during the day and the little plants definitely warm up…
I’m a little bit late to the party but this site is now served over TLS and is thus marked as "secure" in browsers. This blog was originally using Jekyll and was hosted on GitHub Pages, which didn’t use to have support for HTTPS when using a custom domain (which I did). They seem to have added support for it recently but I procrastinated and never actually switched. As I was looking at updating…
As you probably know, the Mac OS X kernel, XNU, is open source and building it from source is fairly straightforward (thanks to yearly instructions by Shantonu Sen). However, building the kernel requires one to install a couple of dependencies that are not available on a Mac OS X installation by default (such as ctfconvert , ctfdump and ctfmerge that are part of the Dtrace project). Since these…
In a previous post I discussed kernel debugging with VMware Fusion and LLDB. In that approach we were connecting LLDB to the kernel via the Kernel Debugging Protocol (KDP). That method works thanks to a stub implemented in the (target) kernel itself. One drawback we discussed was not being able to halt the kernel execution from the debugger and instead requiring a slightly cumbersome keyboard…
Being able to use LLDB to debug anything on my Mac has been the basis of my job for the last few years. Regardless of the particular use case – to debug my own program in Xcode or attach to another process – being able to set up breakpoints and inspect a program call stack frames and memory at runtime is just invaluable. However, there’s one case where one cannot easily attach a debugger at any…
In my last article I mentioned that CFMessagePortCreateLocal() was not usable on iOS, quoting the documentation as evidence. However, I should have known better since I had recently experimented (and succeeded, more about this soon) with registering a Mach port name with the Bootstrap Server on iOS by using XPC. And, as pointed out by Ari Weinstein , it looks like one can indeed use…
With iOS 8, Apple introduced App Extensions. App Extensions are self-contained apps that developers can ship along with their main application. They can be launched on demand by the system to perform things such as sharing, editing a photo, displaying a widget in the Notification Center, presenting a custom keyboard or even provide content to an app running on the Apple Watch. In order to allow an…
I’ve started using Pinboard a couple of years ago and have soon become a real fan of the website. It does everything I need: storing and organizing links I want to remember in the future, without all the social madness that services seem to be crazy about these days. I also admire Maciej’s business model and Pinboard is one the few services that I’m confident with using for the years to come.…
This is a repost of an article I published on the Realmac Software blog . iOS is often criticized for not supporting dynamic libraries. While you might agree or disagree, it is interesting to think about why it is so and how this rule is eventually enforced. In this post we will see what these libraries are, how they come in practice, how they would work if they were fully supported on iOS and…
Since I redesigned this site three years ago I’ve wanted to update it to be more friendly when browsed on mobile devices. I’ve finally found some time to do this last night and I’m pleased to say that articles are now much more readable from your phone! I haven’t updated the stylesheet for tablets since I believe that a desktop-like format is usually a good fit for this kind of device form factor.…
This is a repost of an article I published on the Realmac Software blog . In a previous article I discussed how to debug Objective-C blocks with LLDB and in particular how to disassemble the block’s invoke function. While not particularly difficult per se, the process was slightly tedious, involving quite a few steps. It would be nice if we could automate these steps. Luckily, LLDB has a very…
In the previous post I went through dependent keys with KVO. It is a very powerful concept that will help your code look much cleaner and declarative (even more if used in addition to Cocoa bindings). In this post I’ll discuss a scenario that any developer that ever worked with Cocoa on the Mac will be very accustomed to: NSArrayController and KVO dependent keys. NSArrayController , a subclass of…
In my previous post I mentioned +keyPathsForValuesAffectingValueForKey: and how you should always add the result from calling this method on super to the set you return. I also noted that using +keyPathsForValuesAffecting<Key> could be a bad idea since it adds complexity when using dependencies across a class hierarchy. Let’s see what I meant by that with an example (the example is available as a…
I really enjoy reading the NSHipster blog. The article about Key-Value Observing (KVO) from October 7th was however slightly misleading and should be taken with a grain of salt. I wasn’t expecting much after the introduction (“Key-Value Observing has the worst API in all of Cocoa”) but unfortunately it went from bad to worse. I don’t like to point fingers without explaining what I think is wrong…
This morning I’ve read an interesting post on Oliver Drobnik’s blog and since answering properly on Twitter is kind of hard I decided to write a post about my understanding of the issue. In a nutshell, his post shows how invoking the length method on an object conforming to the UILayoutSupport protocol might not return what one would expect if the reference is typed as id . The reason for this is…
Last week I read a tweet from Landon Fuller that showed the disassembly of +[NSURLConnection sendAsynchronousRequest:queue:completionHandler:] mainly as a simple call to +[NSURLConnection sendSynchronousRequest:returningResponse:error:] dispatched on a global queue. I have never been a big fan of this asynchronous request API on NSURLConnection since it lacks a major feature in my opinion:…
When building a small OS X app some time ago (more about this soon), I needed a way to access and parse the ObjC segment of a given executable. This can easily be achieved with the command line utility otool but the output is not very readable (or parsable). Class-dump Steve Nygard wrote an amazing tool called class-dump for generating declarations of classes, categories and protocols by examining…
This is a repost of an article I published on the Realmac Software blog . I don’t use logging. From the simple printf or NSLog to more complex logging frameworks such as CocoaLumberjack . In this post I will try to explain the reasoning behind it, from a development, testing and release perspective, and propose alternatives that are, in my opinion, much more powerful. During development A common…
While working with iCloud recently I ran into a situation where I wanted to share a link to an item stored inside the application’s sandbox via iCloud. Luckily, since OS X 10.7 NSFileManager has a nice API to create a public URL to an item inside the application’s ubiquity container suitable for sharing: - (NSURL *)URLForPublishingUbiquitousItemAtURL:(NSURL *)url expirationDate:(NSDate **)outDate…
I like listening to podcasts. I find it relaxing and it’s often a nicer way to learn about stuff than by reading an article. I also like the fact that it gives a more human touch to a bunch of people I follow on the Internet. Following is the list of podcasts I currently have in my podcast app (I use Instacast , an app that I couldn’t recommend enough). The Talk Show with John Gruber There’s no…