Here are three small pieces that I discovered while working on my second major Mac app. It’s for internal use by a client, so I cannot tell you about it, but it is a great place for me to learn more about the various oddities you find when developing for the Mac platform.
I noticed the bug when I re-added an Edit menu to a Mac app that I had earlier removed. Turns out that all your NSTextFields lose their ability to cut/copy/paste and undo if you don’t have corresponding menu items.
So after I copied the menu over for another app I found that I couldn’t find the redo: action to connect to the Redo menu item. Filed as Radar rdar://13113666 and cross-posted on Open Radar.
If you use CoreData then you will probably face the problem of database migration sooner or later. Automatic migration is turned on easily, but how can you be reasonably sure that your fresh app update will still be able to open databases using the old schema? Like when people were using the app and are now installing your update that needs more entities.
We were beginning to face this scenario in multiple apps, so we started unit testing CoreData automatic migrations like I’m going to show in this article.
Funny Story: right after I published my findings on how to work CocoaPods I received a couple of pull requests. Should it be actually be the case that fellow developers are beginning to take notice of DTCoreText?
I admit, that for the first few tags/versions of DTCoreText I didn’t take CocoaPods seriously. But since I got down how to work with sub-modules and sub-specs I find that it gives me a great deal of pleasure to keep my specs current.
There are a few trailblazing developers out there who intentionally set their app’s deployment target to iOS 6. When dealing with open source libraries like DTCoreText this might give you a fair share of deprecation warnings. But there is also another problem caused by this that library vendors need to address.
The SDK used should always be the Latest iOS, but the Deployment Target setting tells the compiler and linker at what level of fanciness it can enable the turbo features.
There once was a developer who figured that it would make sense to not reinvent the wheel, or at least not all 4 that he needed for his app/car. He had previously learned how to contribute to open source projects on github and wrapped his head around git submodules. As long as you stay in the git ecosystem all is bliss, submodules contain Xcode projects which are easily added as sub-projects.
The big advantage of sub-projects is that you can debug into these and if you fix something you can easily push that back to the master repository. But this convenience brings with it a drawback: since you have to keep a copy of each sub-module in each project structure that needs them you risk ending up with many different versions of many different components all over your file system.
I noticed this bug in NSTextField already back last year but I procrastinated until I saw it the second time in the second Mac app I am building. I did have a workaround for the bug, so it was not that pressing.
But I guess we should consider it our duty as Mac developers to make sure that Apple knows about bugs for this platform. So finally here’s my Radar for it. rdar://13006140
Let’s say you are building an app that does some sort of file handling where you want to be able to open any and all file types in your app. When your app then launches it would do something with the file, like upload it to a server.
I was not quite certain how to achieve this effect myself, so I turned to Dropbox who are doing exactly that. If you have the Dropbox iOS app install you can open any file in Dropbox. Then you can choose where to put it in your online storage.
How did they do that? Did they register for a truckload of file types? Or is there a shortcut that I didn’t know about yet?
You know I love to hear from developers who are making good use of my open source or commercial components in released apps. A shining example of lat is Ziner.
I asked Ziner’s developer Jay Zhao to share with us a bit of the back story of Ziner.