iOS 6 PTL: Chapter 2 Errata
We made a typo in Chapter 2, section Collection Literals. The syntax for creating a new NSDictionary was written as NSDictionary *dict = @[@"key1":@"value1", @"key2":@"value2", @"key2":@"value2"] The correct syntax is NSDictionary *dict = @{ @"key1":@"value1",...
Read More“New” (well, not really new) PRF functions for PBKDF2
In Chapter 11, I indicated that the only PRF available for PBKDF2 was SHA-1. I believe this was true when it was written (during the early betas of iOS 5), but it was not true by the time iOS 5 was released. iOS offers both SHA-1 and SHA-2 PRFs for use in PBKDF2: enum { kCCPRFHmacAlgSHA1 = 1, kCCPRFHmacAlgSHA224 = 2, kCCPRFHmacAlgSHA256 = 3, kCCPRFHmacAlgSHA384 =...
Read MoreiOS 6 Programming Pushing the Limits
A brief introduction of what’s up in the next edition, iOS 6 Programming Pushing the Limits. http://blog.mugunthkumar.com/products/ios-6-programming-pushing-the-limits/
Read MoreCGLayer no longer recommended
CGLayer may be better on paper than in practice. My new recommendations are the very common CGBitmapContext or CALayer.
Read MoreWeak timers
Chapter 6, page 123 has a potential memory leak in it. In this particular program, it’s not possible for this to really leak, but in general it’s worth understanding the correct way to approach it. In the example code, the view retains an infinitely-repeating NSTimer, for which the view is the target. This is a retain loop, since NSTimer retains its target. There are various ways to...
Read MoreGoing Offline Errata
In Chapter 17: Going Offline, page 324 The code the clears the cached data files has a minor issue. The code in the book is for(NSString *path in cachedItems) { [[NSFileManager defaultManager] removeItemAtPath:path error:nil]; } The path variable in this code is just the file name and not the full path and as such, doesn’t delete the cached data file. Thanks to Brian for pointing this...
Read More