Keep It Simple Stupid

Keyboards on the iOS lock screen

| comments

Apple’s iOS is definitely a user-centric mobile operation system (for regular users, not so much for geeks and hackers). Its thoughtfulness also goes beyond the UI as I’ve discovered an interesting feature about the keyboards on the lock screen.

Replacing iOS application container in terminal

| comments

Xcode has the “Devices and Simulators” window (Cmd+Shift+2) where you can see the applications installed on your iOS device and more importantly can download and upload a data container for an application that you’re developing. That container contains all the data generated by that application, so that for example you can get it into a certain state where you see a bug, save it and then restore it back to device as many times as necessary. The only official way to do that is via this Xcode’s window, however I find it clumsy because you need to open the window, select the application, click the gear icon, select “Download container…” in the popup menu, select where to save it, wait and after a while a new Finder window will be helpfully open, but stealing the focus of course. This whole process is much easier with the iOS Simulator, but sometimes you just need to use the app on a real device.

As alternative, there is this great program called ios-deploy, which can almost replace a container on the device. There are a few questions on StackOverflow, like this one, about programmatically uploading/downloading an app container, however none of the answers provide a complete guide. Here I describe my recent experience with replacing an application container in the command-line using ios-deploy.

fixtags is deprecated

| comments

My fixtags script is an extension for gPodder to automatically fix the MP3 tags (of the known podcasts) so that the Sandisk Sansa Clip+’s official firmware would properly recognize them. More information about this is in my old post. There are no new firmware versions anymore and the player seems to be discontinued.

I’ve started using Rockbox on my player a few years ago and it’s better and has many more features than the stock firmware. Here are some of the ones I’m using:

Airplane mode on iPad doesn’t work?!

| comments

This title reflects my utter surprise when I tested an iOS application on a connected iPad, turned on Airplane mode to terminate the application’s connection with the MacBook Pro… but it continued to work. The iOS application runs a server, publishes it using Bonjour (aka DNS-SD) and a client on the network (my macbook in this case) connects to it. To test some scenarios, I need to block the connection and the natural way is to enable the Airplane Mode or disable WiFi, but neither worked. This was very bizarre.

Thread Sanitizer reports null symbols

| comments

Clang has this useful tool called Thread Sanitizer that can detect data races in a program and Xcode makes it easy to use it by providing the “Thread Sanitizer” checkbox in the scheme’s Diagnostics page for Run and Test actions. I needed to run an iOS program with the TSan to see if it would find anything. It did, but all the stracktraces showed only <null>s instead of all symbols, so they weren’t at all clear. I’ve found a workaround how to see that information using breakpoints.

Removing unexpected event attendees in Thunderbird

| comments

I’m using Thunderbird as the email client for a few mailboxes. It’s a generally nice client (I like the keyboard shortcuts), but with a few rough corners. For example, I got a calendar invitation once and clicked Accept, but the acceptance email was sent from a different account. It wasn’t a very big deal in that case, but still quite uncomfortable.

I’ve been burned once there, so when I received another invitation, I clicked Accept without immediate response. Then there is the “Details…” button when you select the invitation email… and I saw the wrong email again. So the bug isn’t fixed yet (at least for my use case). This question was asked here: with reference to bug 589081.

Since you don’t use Lightning, you can’t change the Email entry in Calendar Properties, so at the moment it seems the only option is to set another account as Default in Account Settings/Account Actions. This is only worth doing if all invitations are sent to the same account.

This is good enough for me (at least for now). To do that, I right-clicked on the mailbox and opened “Settings”; then there is the “Account Actions” button in the bottom-left corner where you can “Set as Default” the correct account. I did that, clicked Accept without sending a response again and the Attendees section in the invitation details window now showed the correct accepted email. Success? Not yet, because that section also showed the old, wrong email as accepted too. I was afraid that in this state Thunderbird would send emails from both the accounts about the acceptance. But how do you remove that old attendee?

I tried changing the default email back to the previous account and declining the invitation, but the program continued to display both. There is no way to do anything with the attendees in that window. So time to dig deeper.

Creating an XCTest extensions target

| comments

The iOS application I’m working on is complicated and consists of multiple frameworks (which correspond to targets in the Xcode project), each one for a separate piece of functionality. Therefore we also have a number of testing targets, roughly one test target per framework. XCTest is the standard testing framework for iOS applications in Xcode, however it’s quite limited, it only has a number of basic assertions. It’s useful to create our own higher-level assertions to make the testing code more expressive. Then the question becomes, how to share those common assertions between multiple test frameworks? Well, create a new framework (target) with those assertions, of course! Alas, it’s not that simple when you need to import XCTest in that framework. I’ll show here how I made it work.

TimeMachine "failed to thin backups"

| comments

TimeMachine is a great program for doing automatic system backups, especially since it’s built-in to OS X and easy to use. I had to upgrade from 10.14 to 10.15 some time ago and the newer version is less stable, and also TimeMachine is now buggy. Specifically it now frequently fails to cleanup backups saying this in the logs:

2020-11-20 11:01:34.467927+0200  localhost backupd[21553]: (TimeMachine) [] Thinning 3 backups using age-based thinning, expected free space: 546.35 GB actual free space: 5
46.35 GB trigger 49.94 GB thin 83.24 GB dates: (
2020-11-20 11:01:40.104450+0200  localhost backupd[21553]: (TimeMachine) [] Failed to thin backup named: 2020-11-18-205528 completion date: 2020-11-18 18:55:28 +0000 error: Error
Domain=NSCocoaErrorDomain Code=513 "“2020-11-18-205528” couldn’t be removed because you don’t have permission to access it." UserInfo={NSUserStringVariant=(
), NSFilePath=/Volumes/backups/Backups.backupdb/mymac/2020-11-18-205528, NSUnderlyingError=0x7f97425bd970 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}

Unit-testing absence of retain cycles in swift

| comments

ARC in Objective-C and swift is a nice technology, between manual memory management and a garbage collector. But it’s not fool-proof and you can still create retain cycles when two objects retain each other. There are numerous blog posts online explaining this problem.

It would be nice to have unit tests to verify your classes don’t have this issue, wouldn’t it? There’s a way to do that.

OSX: Close notification with keyboard

| comments

OS X’s UI looks nice, but isn’t very keyboard-friendly. For example, there is no standard shortcut to expand or minimize a window (yes, Cmd+M typically works, but it depends on the Window > Minimize menu command, which is sometimes not present). The same is true for the notification center, specifically calendar invitations/reminders that display a notification popup by default with two buttons: Close and Accept/Remind later. How do you dismiss it with the keyboard alone?