App Store Tip: Acquiring Screenshots for Devices You Don’t Have in Your Drawer…

Recently when uploading an update of my app to App Store via iTunes Connect, and I was faced with a bit of a dilemma. iTunes Connect needed screenshots from a wider variety of devices than I was originally expecting, and more devices than I possessed. 

The directions referenced this article, which actually is super helpful as a reference for what dimensions of screenshots you will need to upload. Unfortunately, the only physical devices that I have are an iPhone 5c and an iPhone 6 Plus, leaving out the currently-most-important device, the iPhone 6.

So I began musing about this… “Could I use the Simulator?” I thought.

I thought that if I needed to take a screenshot in the Simulator, using the old Shift-Cmd-4 trick would be problematic because the dimensions would be off. Then there would be the inevitable headache of launching Photoshop to get a correctly-sized screenshot, etc., etc….

Thankfully I had the presence of mind to Google this, and StackOverflow came to the rescue!

The key is the fact that the Simulator has a special menu item under the File menu! Contained in that menu, there is one item: Save Screen Shot (Cmd-S).

This will take a properly-sized screenshot for the device being currently used (iPhone 6/6s, iPhone 6/6s Plus, even iPhone 4s…), and you can then use that for your screenshots in iTunes Connect right away! No resizing or editing required!

Here’s an example of the screenshot:


Sure it doesn’t have my carrier information on it but it’s a great capture and satisfies the iTunes Connect/App Store requirements, and that’s what was blocking me from uploading my app! Done!

iOS 9 Tips: Disable Shake to Undo

One of my least favorite features of iOS is Shake to Undo. It’s one of the only ones that I just cannot understand why Apple implemented in the way it’s implemented. It’s not discoverable. It’s not intuitive (honestly). It almost always does not work correctly for me when I perform an undo.

In iOS 9, now we can disable this undesirable feature, and big thanks to TechCrunch for pointing it out.

Disable “Shake To Undo”

I’ve been using iOS on and off for years now. I think I’ve intentionally used shake to undo… maybe 5 times. I’ve accidentally brought up the shake to undo prompt probably 45,000 times. In iOS 9, you can finally disable this gesture. Find the option under Settings> General > Accessibility > Shake to Undo




How to use Helvetica Neue UltraLight (and other fonts) in your iOS Code

One of the more frustrating things about doing things in code is when it comes to fonts. Lately I had to do a guessing game when I wanted to use Helvetica Neue UltraLight as a font in a demo for an upcoming blog post for Cloud City Development, and it was making me crazy playing the “guess the font name in code” game:

“Helvetica Neue Ultra Light”? Nope.
“Helvetic-Neue-Ultra-Light”? Nope.
“Helvetica-Neue-UltraLight”? Nope.
“HelveticaNeue-Ultra-Light”? Nope.
“HelveticaNeue-UltraLight”? BINGO!

It took me a few tries through the trial-and-error method, but I eventually got the right name (as you can see from the list above, it’s “HelveticaNeue-UltraLight”), but it led me to think there must be an easier way.

Enter Font Book.

Font Book is an application that comes with Mac OS X for managing fonts in your system, and it turns out that it can help us as developers to solve these kinds of riddles. The challenge is that the answers are little a bit buried…

So… let’s go through this particular challenge.

First, let’s open Font Book (Look in Applications > Font Book, or if you’re an Alfred or Spotlight search user just start typing “Font Book” and it should pick it up immediately).

When you launch FontBook, it will probably look something like this (select “All Fonts” from the sidebar if it’s not already selected):


Then, the next step is to scroll down and find “Helvetica Neue” in the list of font names, and then expand it and select “UltraLight” node in the list:


If we examine the details in panel on the right, the item we are most interested in is the PostScript name entry, since this is the one that we will use in our code.

As you can see here, the value is “HelveticaNeue-UltraLight”:


We can actually highlight and copy it directly from the detail panel. Very convenient.

Now that that’s done, it’s basically just a matter of plugging in the new value into your code:

myLabel.font = [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:128.0];

myLabel.font = UIFont(name: "HelveticaNeue-UltraLight", size: 128.0)

…and that’s it! Mystery solved!

How to have multiple iTunes Connect accounts, and submit apps

iTunes Connect is a bag of hurt sometimes, especially if you have clients that you work with. One of the biggest frustrations that I have (and hopefully this will be changing in the future) is when you need to submit builds and you cannot use an email for an Apple ID in iTunes Connect to manage your client’s Apps, TestFlight, Users, etc.

While there is no easy way to accomplish this yet, at least there is this post by mokagio that helps ease some of the pain…

How to have multiple iTunes Connect accounts, and submit apps

TL;DR You can’t! There is no Apple way to do it, and this is yet another frustration of working in this platform. The steps described below are just a workaround to handle multiple iTunes Connect accounts in a sane-ish way.

While I don’t love using the Application Loader, at least it works. Also, creating email addresses for Apple IDs with the “+clientname” trick works great if you use a Gmail-based email system, and I’m fine with having my clients use this method when they add me to their iTunes Connect accounts.

Customize the background color and title of a UINavigationBar and the status bar

Here’s an example of how to customize the background and title color of a UINavigationBar without having to use an image (in this case, a blue background with a white title AND white status bar):

    // Set the navigation bar to blue
    [[UINavigationBar appearance] setBarTintColor:[UIColor blueColor]];
    [[UINavigationBar appearance] setTranslucent:NO];

    // Set the navigation bar's title text to white
    [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];

    // Here's where it gets a little weird: we set the barStyle property to *UIBarStyleBlack* to achieve a *white* status bar.
    [[UINavigationBar appearance] setBarStyle:UIBarStyleBlack];

Strange Case of the non-scrolling-to-top UITableView

Earlier today I had a situation in which the gesture to scroll a UITableView to the top by tapping on the iPhone status bar was not working.

Strange and annoying.

On doing some investigation, I found a clue on StackOverflow which pointed me in the right direction. It turns out that if you have a nested scroll view whose scrollToTop property is set to YES (the default), it will prevent the containing UIScrollView (or in this case a descendent thereof, UITableView) from recognizing and responding to that gesture.

In fact, in the documentation for UIScrollView, it says the following under “Special Considerations”:

Special Considerations
On iPhone, the scroll-to-top gesture has no effect if there is more than one scroll view on-screen that has scrollsToTop set to YES.

In my case I have a UIScrollView inside each UITableViewCell, which was defaulting to YES for scrollsToTop. Once I programmatically set that property to NO, the UITableView began responding to that gesture again!

Case Closed!


Xcode Tip: Open multiple projects at once

I discovered this one accidentally since I really did want to open three projects at the same time after opening Xcode.

It turns out that the “Open Project…” dialog in Xcode supports multi-select! So you can Shift-Down/Up to select more than one project, hit Return and all three projects will be opened simultaneously!

I pretty much stumbled on this one when I did an “I wonder if this works” kind of thing at that dialog, and sure enough, it opened all three.




Developing for Bluetooth Low Energy and iOS – Now at Cloud City Blog!

As you may or may not know, I currently work for the software development consulting company, Cloud City Development in San Francisco. They kindly asked me to write a blog post on the subject of Bluetooth Low Energy and iOS, and of course I jumped at the chance!

The great news is that the first part of the three-part series was published yesterday!


Many thanks to the entire team at Cloud City Development for allowing me to work on this very interesting and informative series (and for publishing it!). I will post again when parts two and three are up. Look for them in the next few weeks!

Fixed Problem with Red Bear Labs BLE Shield and Arduino!

Yesterday, I was successfully running the “HelloWorld” demo from Red Bear Labs (using Arduino 1.6.3) and then when I attempted to compile and load the “SimpleChat” sketch, it started to freak out and I was getting ‘EEPROM.h not found’ errors and general mayhem — until this morning.

I’m not sure if this is helpful but I did a couple of things, and now I can see the BLE Shield in LightBlue for iOS and subsequently in the BLEChat iOS app from Red Bear…

For starters, I’m running Mac OS X 10.10.2, and my iPhone 6 is running iOS 8.2, and here’s what I did…

  1. Installed Arduino 1.6.1 instead of 1.6.3 (I find it strange that this would matter, but maybe it does?)
  2. Compiled and loaded the “ble_A_Hello_World_Program” from the Nordic SDK — LightBlue started to see the “BLE Shield” peripheral at this point.
  3. Compiled and loaded the RBL SDK “HelloWorld” sketch and LightBlue still sees it.
  4. Attempted to connect to the BLE Shield via LightBlue and it failed and I didn’t capture the message… sorry.
  5. Killed LightBlue
  6. Task-switched to Xcode and ran the BLEChat project.
  7. “Connect” button successfully connected to the BLE Shield peripheral and I’m receiving “Hello World!” messages.

Hopefully I can get started again and it will be smoother sailing from here on out.

I hope my feedback helps future adventurers!