Category Archives: programming

Monkeypatching Compatibility to Older iOS Versions

The Inevitability of Progress Apple wants all of its users to be on the latest iOS version, and it wants all third-party developers to be quick to adopt new APIs, quick to remove deprecated APIs, and quick to drop support for older iOS versions. While, historically, iOS adoption rates have been rather quick, lately this […]

Using Google’s maps with MapKit

I had a problem. Apple’s map satellite data is old. Google’s is new. It would probably be violating either of their agreements, but this is how to replace the MapKit tiles with Google’s: NSString *template = @"{x}&y={y}&z={z}"; MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template]; overlay.canReplaceMapContent = YES; [_mapView addOverlay:overlay level:MKOverlayLevelAboveLabels]; – (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id <MKOverlay>)overlay […]

Why REST APIs aren’t that great

You’re a developer. You’re using to simple RPCs (Remote Procedure Calls) to communicate with your database server, which is behind a HTTP server. And someone tells you “Hey, you should make REST web services.” You spend a week researching and crafting up your first RESTful API to replace your existing API… and find yourself really […]

NSTemporaryDirectory behavior changed in SDK 6

I had some code that looked like this to clear out the temp folder: NSFileManager *fm = [NSFileManager defaultManager]; [fm removeItemAtPath:NSTemporaryDirectory() error:NULL]; [fm createDirectoryAtPath:NSTemporaryDirectory() withIntermediateDirectories:YES attributes:attr error:NULL];   This used to work. ┬áThe second call to NSTemporaryDirectory() now returns nil or /var/tmp or something equally different from my app’s temporary directory. To fix, cache the […]