In comes Core ML 3. Now we have access to control flow, dynamic layers, new operators, and 100+ layer additions!
In comes Core ML 3. Now we have access to control flow, dynamic layers, new operators, and 100+ layer additions!
For developers on Apple’s platforms, there’s no shortage of news affecting the work you do this year and in the years ahead. From faster apps to 14 new frameworks, there’s more than a little here to blow minds.
In less than one week Tim Cook and the gang will take to the main stage at McEnery Convention Center in San Jose, CA for the Apple WWDC keynote. The Ranch is very excited about WWDC this year and we have some high expectations and lofty dreams of what they will announce.
The new MacBook Pro’s 6 cores and 32 GB of memory make on-device machine learning faster than ever.
Build a framework on the command line to gain an understanding of build errors and Swift and Objective-C interoperability.
Every year brings changes in tech. Here are some of the things I’m excited to learn more about in 2019.
Thinking of migrating your iOS or macOS app from a bunch of
The switch statement is an indubitable strength of the Swift language. Behind the switch statement is Swift’s pattern-matching, which makes for more readable, safer code. It is possible to take the switch’s pattern-matching readability and power and apply it elsewhere in your code.
Color is a fundamental and important aspect of app development. It helps identify brand, evokes emotion, and can even help us determine things like whether or not a button can be interacted with. See how to use the latest SDK enhancements to make working with color in your apps a breeze.
Consider the humble line—just a straight sequence of pixels connecting two points. There are well-known algorithms you can use to do your own drawing, but these days, we have toolkits to do the hard work.
You need to interact with the current Core Graphics context in some manner to actually draw stuff, so it’s good to get comfortable with it, what it does, and why it’s there.
Passwords are the worst way to authenticate users, except for all the other ways we’ve tried. In their 2018 software updates, Apple embraces the status quo by providing their users with new defaults aimed at safety and convenience.
The eyes of the world are on San Jose as thousands of developers, including half a dozen nerds, gathered for Apple’s annual World Wide Developer Conference. This year’s announcements did not feature any hardware updates but there were several software updates that you will want to keep your eye on. Let’s take a quick look at a few updates your engineering team will want to be aware of in the months ahead for Siri, CoreML, ARKit, and Swift. Finally, let’s also take a glance at a major opportunity in 2019 for bringing your iOS App to macOS with a few musings from yours truly.
Starting with macOS Mojave, users can choose to run a system-wide light or dark mode of the Aqua interface. While opting an application into light and/or dark appearance modes is ultimately the choice of the developer, users may come to expect that apps support both. Apple believes some content creation applications may make sense primarily as dark mode only applications.
WWDC 2018 began this week in San José, CA, with the usual excitement of thousands of developers from all over the world that could not wait to learn what new shiny objects Apple would unveil for them. The expectant developer community was not disappointed. Even though the announcements were largely evolutionary and no new hardware of any kind was unveiled, the enhancements to all four platforms (iOS, macOS, watchOS, tvOS) and the development tools were many, and hint at big things to come.
Core Graphics, also known by its marketing name “Quartz,” is one of the oldest graphics-related APIs on the platforms. Quartz forms the foundation of most things 2-D. Want to draw shapes, fill them with gradients and give them shadows? That’s Core Graphics. Compositing images on the screen? Those go through Core Graphics. Creating a PDF? Core Graphics again.
Take a deep dive into the internals of iOS frameworks and learn how to best use (and not use) frameworks for cleaner, faster code and debugging.
In Core Graphics, a path is a step-by-step description of some kind of shape. It could be a circle, a square, a valentine heart, a word frequency histogram or maybe a happy face.
In this blog post, we’ll create a desktop file-management app using Electron and Ember.JS. Electron provides the cross-platform development environment, while EmberJS gives us organization and convention.
If you’re writing Swift apps and not Swift frameworks, do Swift’s access modifiers even matter, or are they just a big distraction?
Should you use BNNS or TensorFlow to add artificial intelligence to your iOS or Mac app? The answer is… both.
Imagine that one day you’re feeding some innocuous looking code to a Swift compiler, and then you get a smackdown of an error. Where’d it go? It got renamed.
selector is key to Objective-C’s dynamic runtime nature. It’s just a name that’s used, at runtime, as a key into a dictionary of function pointers. Whenever you send a message to an Objective-C object, you’re actually using a selector to look up a function to call. Sometimes selectors bubble up in Cocoa/CocoaTouch API, and you will need to deal with them in Swift.
Apple has been using machine learning in their products for a long time—Siri answers our questions and entertains us, iPhoto recognizes faces in our photos, Mail app detects spam messages.
As app developers, we have access to some capabilities exposed by Apple’s APIs such as face detection, and starting with iOS 10, we’ll gain a high-level API for speech recognition and SiriKit.
Swift 3.0 changes the semantics of
ImplicitlyUnwrappedOptional, and is even safer than its previous incarnations. What has changed in Swift 3.0 for this type that improves the language’s safety? The answer has to do with improvements in how the compiler infers type information for
WWDC 2016. New Notification Center features? Eh. Bouncy sticker graphics giant emoji in Messages? Blah. New file system? OMG. Apple File System. APFS. NEW FILE SYSTEM!. That wasn’t on any Rumor Radar that I had seen.
With the advent of WWDC comes a lot of new information. Don’t want to wait for the WWDC 2016 videos? Start with our list of recommended reading.
As I type, Apple’s yearly developer conference, WWDC 2016, is in full swing. The keynote can be watched via Apple TV and their website, or you can catch summaries and highlights on every site that covers Apple’s doings.
Apple’s bundled test framework XCTest provides a very limited, general collection of assertions. These get the job done much of the time, but sometimes they’re not the right tool to communicate what you’re actually checking. That’s when it’s useful to know how to write custom assertions that clearly express what you are truly checking for without getting lost in a maze of little this-that-and-that assertions.
Protocol-oriented programming leverages Swift’s features in a powerful way, but there are practical concerns, like whether you want both value types and reference types to be able to conform, limiting the application and usability of a given protocol. This post provides an example where the developer may want to make this limiting choice, elucidates the tensions in making the decision, and discusses some strategies in moving forward.
As app developers, we don’t have the luxury of shipping our software exclusively on the latest-and-greatest OS version. We want to use the new shiny toys, but we also need to be able to work on older versions of the OS that don’t have these features. Swift 2.0 introduced a new language construct,
#available, that helps solve the problems that crop up when your app needs to support multiple versions of iOS or OS X.
When we at the Ranch use Core Data, we inevitably end up using it in a multi-threaded environment. The Right Way™ to use Core Data across multiple threads is a topic of fierce debate, one that we had ourselves when we set out to create a shared Core Data stack.
As my fellow Nerd Juan Pablo Claude pointed out in his post on Error Handling in Swift 2.0, the latest iteration of Swift introduces many features, and a new native error handling model is notable among these. While Juan Pablo’s post offered a bit of history and differences between Objective-C and Swift error handling, today I’d like to dive into the differences in error handling between Swift 1.2 and Swift 2.0.
One of Xcode 7’s new features is in-line display of code coverage metrics. Yay? That’s a pretty dull way of describing a nice feature. Code coverage figures out which lines of code have been executed while running unit tests, and now Xcode shows you information about this coverage in the UI.
When Apple announced Swift 2.0 at this year’s WWDC, Swift’s main architect, Chris Lattner, indicated that the 2.0 update to the language focused on three main areas: fundamentals, safety and beautiful code. Out of the list of new features, improvements, polishes and beautifications, one that may impact your Swift 1.x code the most is error handling.
Microsoft Azure, a cloud storage and computing platform, is a one-stop shop for virtual machine hosting, web hosting, machine learning analysis, web-enabled databases, content delivery and more. Here's how to get started.
…and upon looking into the face of indescribable horror, a bug so unfathomably odd that it shook the foundations of all meager human beings, I was overcome by an indistinct feeling of dread and approximate horror previously unfamiliar to me.
You can find Part 1 of this series here.
You can find Part 2 of this series here.
Although the iOS 7 adoption rate is now at 85 percent, many developers still need to support iOS 6. I've seen people struggle with designing their interfaces so that they look at home on both versions of the operating system. This blog post will show you the best practices for achieving this goal.
Last week I walked through finding and fixing My Favorite Bug. Observant readers may have noticed a multi-step process outlined by some <H3> tags. Get the Attitude, Do Corrective Maintenance, and so on. What was that?
At the end of last year’s storytelling session I mentioned that my favorite story is “Two programmers fixing a show-stopper bug over 24 hours, with the fix being a two-character change in the source code that resulted in a two-bit change in the compiled program.” Here it is.
I love stories. I love telling stories, and I love listening to stories. I learn from stories. I believe that we, as a programming community, don’t tell enough personal stories around the campfire.
I’m a big fan of caveman debugging. That is, using log statements to gather information and visualize a program’s control flow. But I only use it very tactically: I need this one piece of information. Add a log or two and see what I get. Once I solve the problem I take out the logs before sending the code out for review and checking it in. I consider caveman debugging different from the logging an app does to report its activity or health. This should be designed like any other feature, and not be dependent upon developers randomly scattering log statements around the code base.
I’ve talked about stochastic profiling in the past, such as the fairly recent Rock Heads. It’s something I mention when I talk about debugging or performance tuning at various conferences. Interestingly enough, I had a need for it last night because I had stumbled into an often-reported, difficult-to-reproduce problem and wasn’t in a situation to hook up Instruments.
iPhone 5s. iPad Air. The 64-bit era has moved from the desktop and into our hands. Mike Ash has an excellent article covering what 64-bit ARM is. I’m here to explore some of the day-to-day implications of this 64-bit thing.
Every great developer should know how to use a debugger. Xcode has an excellent debugger UI that wraps LLDB (or, if you’re living in the past, GDB), giving you access to all the standard tricks like breakpoints, stepping in and out and around your code, and stack frame details.
One of the wonderful(?) things about Objective-C is that it’s based on C. Part of the power of C is bit-bashing, where you can manipulate individual bits inside of a piece of memory. Have a bunch of boolean values but don’t feel like wasting a byte or two for each one? Represent them as individual bits! Luckily we tend not have to do this a lot of these days given the massive amounts of memory that we have to play with, even on iOS devices. That being said, there are times where bitwise operations appear in the Cocoa APIs, so it’s good to be comfortable with a couple of basic operations.
One of our interns recently asked what seemed like a fairly innocuous question: “What are the scenarios where the use of instance variables would be more preferred than using properties?” At Big Nerd Ranch, we strongly prefer using properties to direct ivar access, but take a sampling of the Objective-C community and you’ll find almost as many answers as there are developers:
The Instruments Time Profiler is a common tool to use when finding out how much CPU time is being consumed for an operation, either directly by a function or a method, or on behalf of some other piece of code. You might discover that your image drawing is causing huge amounts of image conversion inside of Quartz. You’d then make sure your image is in a state that makes it draw faster.
Part of the fun of teaching a live class is fielding questions and thinking on your feet. Once I was showing some code that used @properties extensively in the interface, and one of the students asked “What are all the little fiddly bits that go after the
@property? I’ve used retain and assign and nonatomic, but don’t really know what they really do.” (There’s a TL;DR at the end of all the
@property attributes if you just want a quick cheat-sheet.)
UIKit Dynamics is one of the more fun parts of iOS 7, giving us user interface elements that mimic real physical objects. They can bump into each other, move and spin, fall with gravity and bounce around on invisible springs and strings. I decided to build an app that plays Pong using only UIKit in order to see how it all worked.
Even though Apple is known for limiting what you can do on iOS compared to Mac OS X, they actually provide you with some information about the OS and hardware environment you’re running in, assuming you know where to look. Here I’ll be looking at three different places to accumulate this info: the
NSProcessInfo, the application bundle, and a Unix system call.
I sometimes see the question “How do I cast a method into a function pointer?” come up during classes or on some form of social media. One problem programmers have, which asking questions, is phrasing the question too specifically. In this case, the real question is “How do I use an Objective-C method as a callback for a C library?” Casting a method to a function pointer is one possible way of solving the problem. Is it the right way?
Want to learn more about what’s really happening inside those square brackets? Read the entire Inside the Bracket series.
Want to learn more about what’s really happening inside those square brackets? Read the entire Inside the Bracket series.
Want to learn more about what’s really happening inside those square brackets? Read the entire Inside the Bracket series.
I was one of five lucky Nerds who got to attend Apple’s WWDC this year, and it has been a blast so far. The keynote was probably the most exciting in terms of the big-picture changes coming from Apple. Interestingly enough, the big picture means focusing on the little things.
Today we’re going to look at using Objective-C’s array and dictionary subscripting syntax with older iOS and OS X versions.
So. That Clash of the Coders Thing. Kind of nice being able to flex mental muscles over a 72-hour sleep-deprived Dr Pepper-infused period of time, performing acts of violence upon the Objective-C runtime,
UIApplication, and the layer stack. It was a blast being able to use all my platform knowledge with the express purpose of subverting it.
I was hanging out on the #macdev IRC channel on Freenode the other day when someone asked a question: “
static has different meanings based on the context it is placed in, right?”. Indeed, it has different meaning. And yet it’s the same. Static is a C Koan.
Instruments is a cool tool. There is a lot it can do beyond “simple” things like profiling your application’s execution time or finding your memory leaks. It can also give you holistic views of the activity on a device, such as power consumption.
You can find all sorts of interesting and useful stuff in Apple’s header files. Don’t be afraid to explore them. I usually troll through the headers when a new major SDK version comes out (like IOS 7 probably will be this year) to see what’s new. I also use them for API exploration. As always, when in doubt be sure to read the official documentation. Apple’s documentation is good. It’s also voluminous. But once you’ve marinated in a framework for awhile, you know how things work and might only need a refresher or a nudge in the right direction. These days I usually spelunk in the headers, and then hit the docs if I’m not sure what the headers are trying to tell me.
Just got back from the DC area, where some fellow Ranchers and I went to CocoaConf. If you’re not familiar with CocoaConf, it’s a traveling technical conference for Mac and iOS developers. I like to call it a peripatetic conference, where Dave Klein (who runs the conference) travels around with his family to different cities and puts on a great conference. There are conferences coming up in Dallas April 4, and in San Jose April 18.
Simple questions can be fun. A friend in the Pittsburgh CocoaHeads said “Hey MarkD. We’re having a discussion at work on the right way to iterate through an NSArray. One dude said to just use the
for...in syntax, and the other said that we should always use the block based iteration form. What do you think?”
I lied. Sorry. I thought this dive into DTrace would be a three-parter, but here’s a part 4, on static probes, suggested in a comment by Chris last month.
As you’ve seen before, DTrace can give you a huge amount of visibility into the guts of your computer. You saw the
syscall provider which lets you attach probes to system calls, those functions that let you take advantage of services from the kernel. You also saw the
pid provider which lets you look inside individual processes and trace the function activity inside of there.
The other day I was chatting with one of my colleagues at the Ranch and he asked me where I get my blog ideas. One fertile idea-ground is what sometimes happens during day-to-day work, solving a potentially hard problem in a way that’s actually pretty easy. And then I discover there’s a fair amount of ground work needed to understand it. Hence these multi-part War and Peace epics.
Mac OS X Lion introduced sudden termination, an opt-in feature for Cocoa apps that allows the system to terminate apps that aren’t in use and transparently re-launch them when the user brings them back to the foreground. This allows the system to keep resource usage as low as possible, but it also puts an additional burden on the developer to ensure that when the application is re-launched, it looks just like it did when the user last saw it. You’ve probably seen this in document-based applications that remember which documents were open when they last ran.
Sometimes things aren’t as simple as they appear. One of my former students was asking what
id * meant. This seemed straightforward enough, but as I started exploring the question in more detail, things were becoming curiouser and curiouser.
Last fall I took a week off to escape from the world. I assigned myself three tasks for that time: disappear and recover from a number of stressful deadlines, clean up my office area (affectionately known as “my cage”), and learn about CocoaTouch gesture recognizers. I ended writing a little tool for playing around with gesture recognizers that I called GestureLab.
Grand Central Dispatch, a.k.a libdispatch and usually referred to as GCD, is a low-level API known for performing asynchronous background work.
dispatch_async is its poster child: “Throw this block on a background thread to do some work, and inside of that block toss another block on the main thread to update the UI.”
Update: In the time since this blog post was published, the compiler behavior demonstrated has been remedied in the version of clang accompanying Xcode 4.6. For a BOOL generateMipmaps, @(generateMipmaps) now evaluates to kCFBooleanTrue or kCFBooleanFalse.
Come for the knowledge, stay for the prize.
Last time you met some utilities for creating rectangles. Now it's time to actually start using them.
Geometry is everywhere in modern programming. We have to know how to deal with points, sizes, and rectangles. Back in the old days we’d use
NSRect. These types were bitwise-identical with their Core Graphics counterparts (
CGRect), but weren’t type miscible, so you had to play games to use use one where another was wanted. With modern flavors of Cocoa, we can use them interchangeably. If you’re looking at a codebase that has both NSBlah and CGBlah for basic geometrical types, rest assured they’re the same at the bit-level.
Fast Enumeration, part 1 covered what fast enumeration is. Part 2 covered the method
countByEnumeratingState, which is the centerpiece of fast enumeration. This time around there’s actual code which implements a collection that can be fast enumerated, without cheating and falling back on one of Apple’s collections.
Fast Enumeration, part 1 covered what fast enumeration is,
NSEnumeration a bit, and introduced adopting fast enumeration in your own classes by doing a simple pass-through to Apple’s collections. This time around it’s time to look deeper at the central Fast Enumeration call, which I’ll refer to as
Fast Enumeration was introduced into Objective-C back in the 10.5 days. It’s the feature that lets you succinctly iterate through a collection:
This question came up in an IRC channel the other day: “What’s the best way to set up a property that’s read-only externally, but modifiable inside of the class, so I can use properties or KVC to change it?”
__unsafe_unretained. That sounds pretty scary. It’s a new symbol added by ARC that’s used to decorate pointers. It pops up in Xcode’s autocomplete occasionally, and sometimes you see it in code you find on the net. What is it? When would you want to use it?
I usually encounter two classes of bugs on a regular basis. The first is of the form “I think I know where this is” which won’t take long to find. The steps are pretty easy: Figure out how to reproduce it. Set a couple of breakpoints. Add some caveman debugging. Find the problem and fix it. These are my favorite kind of bugs because they’re over and done with quickly, I can get a quick hit of that “you done did good” glow from making a software system better, and then move on to some more interesting problem.
When I’m developing new code, my usual habit is to do a lot of small iterations. That gives me a little bit of success fairly often. I’m not as happy if I have to work for a long time until I can see something appearing on the screen.
Today is Labor Day over here in the states, with many Nerds are taking a well-deserved break to go out into the Big Room and enjoy the company of friends.
CocoaHeads Boise on twitter asked for an elaboration on big vs little endian. In the query was a very interesting statement: “surprised not mentioned in my C books.” I had never thought about endianness issues being covered in introductory materials .
As happens occasionally, an interesting technical discussion ensues in an IRC channel. Earlier this week, this question came up why does Apple do this to most of their
enums in the Cocoa headers:
Cocoa has a number of classes that can hold arbitrary amounts of Stuff. Things like arrays, dictionaries, sets, index sets, character sets, strings, data, strings, and so on. These classes come in two flavors, mutable and immutable.
I like warnings. I really do. It reminds me that the compiler loves me and is looking out for me. (OK, the compiler at least tolerates me.)
You know that feeling. You’re on a deadline. It’s 9:00 at night. You have a demo the next morning. Suddenly Xcode freaks out. Apps running half the time. Rebooting your phone. Rebooting your computer. Finally the phone decides to run your App for awhile.
Special guest post by Jonathan Blocksom, director of the Big Nerd Ranch DC office, and Advanced iOS course co-creator.
Last time you saw how to register for notifications. Now time to handle them!
Notifications on the brain. Last time was a bug report about something I stumbled across when debugging some notification-related stuff. Before pursuing that much farther, I figured I’d talk about notifications.
Ever be coding along, giddily hooking objects together and doing that voodoo that you do so well, and all the sudden you hit a wall. Things stop working. You’ve hit, what could be, A Bug. “Can this really be broken? What’s going wrong?” And then you’re stuck in a gumption trap , shaving yaks until you can get back to your important work.
Just got back from a weekend at CocoaConf down in Herndon VA. A lot of great sessions from Ranch folks, and from everyone else as well. One of my favorites was the session Chad Sellers from Useful Fruit had on Text, covering the text system from
NSString up through
NSTextView and back down to Core Text. I learned stuff.
I’m a fan of Caveman Debugging, where you use print statements to trace program flow and display specific program information. I was kind of surprised when reading Coders at Work how many industry luminaries do the same thing. It’s just another tool in the debugging arsenal, along with unit tests, debuggers, Instruments, and the plethora of other software investigation toys.
Today’s topic was suggested by Paul Bruneau - thanks!
Apple’s WWDC is next week! Woot! But I know a lot of folks can’t make it to WWDC. There are a number of conferences happening over the summer for folks to get their technical info fix.
I got a question from a friend of mine the other day:
Saving data to the file system and reading it back is a pretty common operation. One of the first ways many Cocoa and iOS programmers learn to read and write are by using the convenience functions provided by
NSData, and friends.
writeToURL:atomically: for writing and
dictionaryWithContentsOfURL: for reading.
Instruments is a very cool profiling application, but it’s one of those things that’s kind of hard to write about. You can outline the features it has, create some contrived debugging situations (“oh look, I’ve introduced a memory leak where no sane person could have accidentally created one.”), and make some pretty screen shots.
Update October 2013 - On 64-bit iOS (device and simulator)
BOOL is now actually
bool, so the sharp corners have thankfully gone away for that platform. For everything else, though…
If you’re an iOS programmer who only programs CocoaTouch, I want to encourage you to give desktop Cocoa a try. I’ve primarily been shipping iOS software for the last two years, but I’ve also been doing a fair amount of Cocoa programming on the desktop during that time, either writing helper tools or implementing parts of the iOS app on the desktop.
Every now and then I get a question about an idiom I use for looping through a collection of literal structures. This is handy for little lookup tables, or using pre-defined data to populate another data structure.
An idiom used by some Objective-C programmers is prefixing instance variable names with underscores. You do see this with explicitly declared instance variables:
One of the directions Apple is taking in Objective C that I’ve come to really like is the migration of stuff out of header files. I’m a firm believer that header files should only contain the public programming interface, along with any bookkeeping the compiler absolutely has to have And nothing else. Anything that doesn’t contribute to a person’s understanding of how to use your class shouldn’t be in there.
Last time we talked about protocols and why you’d want to use one. So, when would you want to make your own protocol? You make protocols when you’re defining some kind of mechanism for your object to use other objects to do its work. One use of protocols is defining the set of methods used for plugins. AMOSXP(3) has a section that builds plugins in Cocoa, using a protocol to spec out how the plugin and the host application interact with each other.
The last post about isEqual: vs isEqualToString: included some timings I made to test the performance of those two calls, along with
compare:. That posting mentioned going down a rabbit hole, verifying commonly held beliefs of about
isEqualToString:. The other rabbit hole I went down related to the performance tuning. A couple of commenters on the post asked some good questions relating to the timings, especially about literal strings.
_TL;DR: When to use
isEqualToString:? There’s no meaningful performance difference between the two. For convenience use
isEqual:. For a modicum of type safety use
isEqualToString:, but it’s not as safe as you might believe. If you have unicode strings with different normalizations, use
compare:. Be careful if
nils are involved.
We have a lot of very convenient, very powerful methods at our disposal such as
[NSData dataWithContentsOfFile:]. This method goes to the file system, opens the file, reads in all the bytes, closes the file, packs the bytes into an
NSData, and returns it back to us. It replaces a loop and several other lines of code into one convenient package. If it can’t do the work, it returns
nil. That’s pretty simple.
You might want to check out Part 1 if you haven’t already seen the new
NSDictionary literal syntax, and using square brackets to dig into collections.
Update : Official Documentation now
Most Mac programmers have used the command line, even if only briefly. Some use it to drive their source code control, some use it for Unix utilities like
grep, and some use it to build and run. There’s a handy technique using the command line that lets you exert control over your GUI apps.
Timing how long a block of code takes is a useful tool. Maybe you’re choosing between two different calls that do similar things and you’re wondering which one is faster. If one is faster, is it faster-enough to make any difference? The usual techniques involve using a profiler like Instruments, or calling a time function like
gettimeofday() before and after your code and calculating the delta. Those of us on mach-based systems like iOS and OS X can use
mach_absolute_time(), which is the finest-grained timepiece available on the system.
My fellow Advanced Mac OS X Instructor, and general all-around super-nerd Jeremy W. Sherman digs into the tantalizing possibility of @import syntax.
Objective-C categories are cool. They allow you do something that you can’t do in most compiled languages: add new methods to existing classes. You can even add methods to classes that you didn’t write.
One of our engineers was working on a project and wrote some code that crashed when running on a device:
Let’s face it. We all have questions. Why is the sky blue? What shirt will I wear today? Why does mommy spend so much time on the phone with “the handyman?” Thanks to the Big Nerd Ranch, there is now a place to ask these questions, and more.
I just open sourced a simple persistence layer for Cocoa and iPhone that uses Tokyo Cabinet. If you are frustrated with Core Data, you might find it useful. Check it out on GitHub.
I was asked three times last week how I find how long an activity takes on the Mac and the iPhone. Â Here is the most accurate method that I know of:
As you probably already know, this week marks Apple’s WWDC 2009 Conference in sunny San Francisco, California.
We apologize for the missing content on this page. You can find other posts on XML and related topics at our blog.
My editor at Addison-Wesley wrote me today. He says that 6000 copies of “Cocoa Programming for Mac OS X, 3rd Edition” are on trucks. I think the 3rd edition is pretty good; it adds two chapters on Core Data, and chapters on the garbage collector, Core Animation, Web Services, NSTask, and NSViewController. A lot of little things were tidied up.
Some small fixes – some users complained that the top and bottom margins were too large, so I’ve made the call: All modern printers can print to within one third of an inch of the edge of the paper. I had a bug where I was mutating a collection while iterating over it – 10.5 is much more uptight about such things. Also, the template pages had no calendars for 2008 or 2009.
At Big Nerd Ranch, we follow a pretty minimal style for our slides. It is important to us, however, that our slide shows go in and out of subversion easily. Also, it is important that we can easily generate a book from a collection of slide shows. As such, we have written our own replacement for PowerPoint.
I am speaking this week at the OpenBase Summit 2007. I am doing a short introduction to Cocoa. Most of the people in the audience are OpenBase users and a large number use the LightSpeed Point-of-Sale system. (LightSpeed stores its data in OpenBase.)
When I released PagePacker a week ago, I thought it might be handy for a few people. (See the original post if you don’t know what I am talking about) Now that thousands of people (literally) have downloaded it and given me feedback, I’m quickly getting out a new version with:
I often wander around without a computer, so I needed a nice easy way to print important bits into little books of information that I could carry around in my pocket. Chad Adams figured out a brilliant technique of cutting and folding pieces of paper into little books and called it PocketMod. The technique was brilliant, but the software was a little awkward. So I, knowing a little about Cocoa, hacked together PagePacker. Click here to download PagePacker. It is a universal binary that runs on MacOS X 10.4. It has some informative help, too. (This version will expire in June. In June, it will be time to upgrade to a new version for Leopard.)
When I spoke at the Student Session at WWDC, I announced that I was taking submissions for a framework of reusable Cocoa classes, and that I would give the best entry a free seat in a Big Nerd Ranch class. I was expecting a flood of submissions, but only received five. I’d like to thank Drew Hamlin, Christoph Angerer, Nate Roberts, Daniel Beatty, and Trevor Johns for their submissions. I am pleased to announce that Christoph Angerer has won the contest for his BNZTransactionalNotificationCenter.
As a consultant, I am working on a piece of software for an engineering firm. The engineers would like an easy way to write plugins for the application. I thought to myself, “Myself, perhaps the plugins could be written using Python.” So, I downloaded the latest version of PyObjC and installed it. This posting is to share the three examples that I wrote in my exploration.
With recent versions of Xcode, the palettes exercise in Cocoa Programing for Mac OS X has become unusable. These days, when you create a palette project, Xcode creates a palette target and a framework target. Thus, the palette chapter has become a palette/framework chapter.
Supporting old OS versions is always a lot of work for application developers.
With Tiger, Apple has started using SQLite in many ways. Most notably, SQLite is the recommended store for Core Data applications. This column, which originally appeared in MacTech Magazine covers some of the things any Cocoa developer should know about SQLite.
Two glowing reviews of Advanced Mac OS X Programming have appeared:
This article, originally published in MacTech Magazine, gives tips on how to write your code such that retain count problems are easier to find and how to locate the problem when symptoms appear.