Implementing Background Fetch

Some of the apps I work on have periodic updates of information like news that I thought would benefit from new iOS 7 multitasking functionality.  If I could update the app, I thought, while the user is not using the app then when the user opens the app the news will be fresh, new content will be available, and the user will feel no need to do a pull to refresh. Better yet if somehow I could predict when the user uses the app I could schedule the update just before they use it.  Well, turns out iOS 7 introduced new background task handling that helps developers achieve this exact user experience.  The functionality is called Background App Fetch.

How does it work you may be thinking.  Continue reading

Implementing a Custom UIActionSheet

This week the need arose to have a more powerful UIActionSheet that went beyond having just buttons. My initial reaction was to simply subclass UIActionSheet and add whatever was needed.  But an argument arose at to whether this was the best approach since Apple clearly indicates in the UIActionSheet Class Reference that

UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more customization than provided by the UIActionSheet API, you can create your own and present it modally with presentViewController:animated:completion:.

Continue reading

Implementing Dynamic Type Support

iOS 7 introduced typographically heavy and complex designs that pushed solutions using string drawing and WebKit (both based on Core Graphics) to the limit. Going down to Core Text (an Advanced Unicode layout engine) may be overkill to simply render a label. Apple’s answer was Text Kit which is a fast, modern, object-oriented text layout and rendering engine which is built on Core Text and is tightly integrated with UIKit. In fact, all of Apple’s UI text-based controls like UILabel, UITextField, UITextView, and even UIWebView were rebuilt on top of Text Kit. This should provide seamless animations in UITableViews and even UICollectionViews.

This week I had the opportunity to get into Text Kit. The app I am working on has some views which are text heavy and to some have a small, hard to read, text. The answer was Text Kit’s Dynamic Type that provides designed type styles that are not only optimized for legibility but also user selectable through the Accessibility Settings on the iPhone. Getting this to work was easy and I started by building a prototype so as to know what I needed to add to the app. I’ll describe step-by-step what I did to build the prototype and although I have the prototype posted on GitHub I recommend you follow along step-by-step. Continue reading

View Controller With No NIB

On the whole, a view controller is created exactly like any other object. A view controller instance comes into existence because you instantiate a view controller class, either in code or by loading a nib / xib / storyboard.  Beginners are taught to make Apps with Storyboard and that is great. Storyboards and Segues are an amazing addition to Interface Builder now all rolled into Xcode.

When working on a client with another developer there were times when we would have merge conflicts due to just even peeking at the Storyboard (which serves as a good reference and documentation for the project). Almost every check-in we had to double check and redo some small change and we were checking in often. There were only two of us so as the team grows these merge conflicts I can only imagine would grow. For the reason of multi-developer environments there are firms who do away with not just Storyboards but Nibs / Xibs in their entirety.  I thought I’d create an App with a TableViewController that has no NIB as a reference for those who have never seen how this is done.  This code is in Github.  Continue reading

WD My Cloud NAS on Ubuntu

I decided that 2014 for me was going to be the year of the Network Attached Storage (NAS). Last year was the year that I finally abandoned my desktops and went all laptop for both my Mac-based iOS development workflow and general purpose computing (i.e, everything else on my Acer i5 running Lubuntu). This year I wanted to have a massive centralized storage where I could put all my videos and photos so I can access it from any laptop or mobile device. What follows is what I chose and how to hook it up to Lubuntu.

Continue reading

iOS Tutor 1.1 Update

iOS Tutor 1.1 Update

iOS Tutor 1.1 Update

My iOS Tutor App has today received its first update bumping 1.0 to 1.1. Although, it has only been four days since 1.0 went live I did plan on a delayed launch of 1.0 in order to give me time to prepare as many lecture decks as I could for launch – plus add the four day Apple review time (which is actually quite fast) and you have a solid 1.1 that was building up. Continue reading

First AppStore App: iOS Tutor

iOS Tutor in the AppStore

iOS Tutor in the AppStore

On Wednesday, November 6th, we presented three ideas for hackathon apps and we voted on which would be the best.  I was surprised that my Flash Card idea was voted my best idea because it would promote the excellent Stanford iOS course and not the Flatiron School.  But I accepted the class’ judgement and proceeded for the next three days to hack out what would become my first AppStore App.
Continue reading

Adding Core Data

Working on updating my hackathon application for AppStore submission I wanted to do some Core Datafication on it: that is add Core Data to an existing project that did not have the Core Data shizzle in it before.  For the hackathon I used pLists to have initial data which is one step better than just hardcoding but not scalable.  I’ve added Core Data to so many apps by now but find myself always cheating off myself and going back to my notes such that I thought it was time I centralize the four easy steps needed.   Continue reading

New Radar

Today, for our CapStone we started continuous integration with Xcode 5 Bots. Upon writing my first test using two of the same singleton objects A & B to test equality with XCTAssertEqual(A, B, @”Equality”) the notification came in as “Test Failed.” How can this be? We are using boiler plate singleton code.  What is especially troubling is that in Xcode the test is showing green and indicating having passed.  What gives? I executed the test again and the notification came in “Test Succeeded.” Weird.  I tried it again and again and it fails here and there with no distinct pattern.

This was a Radar I thought and I posted:
XCTest Notification Shows Test Failed on Successful Testsrdar://15515678

My previous Radar has since been closed by Apple Developer Relations as a duplicate yet two weeks later Game Center is still not showing up as a search result at Apple.com.
Game Center Link Is Broken on Apple.comrdar://15417484 – Closed as duplicate of rdar://15417000

I also opened a feature request Radar for the issue I wrote about in yesterday’s blog entry entitled “Formatting Phone Numbers on an iPhone“:
Telephone Number Formattingrdar://15516158

Formatting Phone Numbers on an iPhone

With my Corporate Directory CapStone project I found myself needing to format a phone number in phone fields like cell phone, home phone, office phone, etc.  I was surprised to find this is not as easy on an iPhone as you may think.  Even though clearly Apple has this functionality in Contacts they have no Public API for phone formatting.  You may think what’s the big deal anyhow. Well, in the US you could have a leading 1 or not and you want to be consistent with area code segmentation and then there are international numbers.  I started looking on stackoverflow but thought there ought to be a better way than implementing my own NSFormatter. Continue reading