We all love Siri’s little witty quips, but I recently read a heartwarming article over on Mashable that reflects the power of technology to change lives in ways that most of us would never appreciate. I won’t spoil
Automatic Reference Counting (ARC) has been around since iOS 5, however it has been an optional tick box when beginning a new project, and if not selected, Manual Reference Counting (MRC) is used. As of Xcode 5, the ARC tick box is missing, and all new projects start with ARC. While you can still disable ARC manually in the project's config file, this is probably a good sign that ARC is the way to go for new projects.
When you send a build to your client or testers, it can be difficult telling development builds from AppStore builds. At b2cloud we split the builds with two different app ids, and a different app title to make it easy to tell them apart. Because the app id is different it means you can have both builds on your device at the same time, and the development one wont overwrite the AppStore one, and vice versa.
Xcode’s “Analyzer” is normally a great way to determine where most memory leaks will occur in your project without actually running it. If you follow Apple’s Memory Management Guidelines the Analyzer is pretty accurate. By no means is it a replacement for the Profiler, but offers some quick checks.
When using delegates in an object in Objective-C it is important that the delegate is only assigned within your object, and never retained. The reason for this is to prevent a retain loop, where two objects retain each other; they will never be released. The fix is simple, but can catch you off guard if you want to create an array or dictionary of delegates (using an NSDictionary or NSArray).
If you have ever needed to store a password or other sensitive data in an iPhone app, you have probably used Keychain Access, Apple’s solution to storing data securely. You have also probably used Apple’s KeychainWrapper class, offering a very easy wrapper to storing info in the keychain.
The KeychainWrapper worked well in debug mode, but when building for release it didn’t seem to be writing objects to the keychain. I was fumbling around with this for hours, going over my own code thinking I had made a mistake somewhere. In the end I figured out what the problem was, in Apple’s code for KeychainWrapper the actual line that executed the commit to the keychain was inside an NSAssert, which is used for development, but as soon as you build for release or distribution every NSAssert is nullified, giving the same effect of commenting out anything on that line, removing the keychain commit code.