"How to Unleash Your Inner App Developer" – My New Weekly Blog for iPhoneLife magazine!

All the best!

Kevin McNeish

FourBooks

Author: iOS App Development for Non-Programmers book series
Twitter: @kjmcneish

Confessions of a Pizza Stalker

Well, this doesn’t have anything to do with iOS, Android, or .NET, but, my wife Sharlene has a great new blog that’s targeted at any of you pizza fanatics out there (and if you write code for a living, I KNOW you’re out there)! Here it is:

http://www.pizzastalker.blogspot.com

We both attended the Pizza Expo 2013 in Las Vegas last week and it was a blast!

All the best!

Kevin McNeish

FourBooks

Author: iOS App Development for Non-Programmers book series
Twitter: @kjmcneish

Q&A: How To Fix Xcode’s "used as the name of the previous parameter" warning

When you upgrade to Xcode 4.6, you may find that you are getting a number of compiler warnings like this:

‘xxxxx’ used as the name of the previous parameter rather than as part of the selector

In this post I will show you why you’re getting this warning, how to fix it, or how to ignore it.

Why You’re Getting This Warning

This is typically caused by declaring a method without specifying a description of the parameter. For example, check out the following method declaration:

– (NSString *) getFormattedDateString:(NSDate *)date:(NSString *)formatString;

The intent of this code is to declare a method named getFormattedDateString that accepts two parameters named date and formatString.

Because there is no space between date and the colon (:), the compiler gives the warning “‘date’ used as the name of the previous parameter rather than as part of the selector”.

How to Fix The Problem

There are two ways to solve this warning:

1. Put a space between date and the colon:

– (NSString *) getFormattedDateString:(NSDate *)date :(NSString *)formatString;

2. Add a description for the formatString parameter:

– (NSString *) getFormattedDateString:(NSDate *)date withFormat:(NSString *)formatString;

The second option is preferable because it makes your method more readable. That;s because parameter descriptions are part of the method signature. In this example, the method signature is:

getFormattedDateString:withFormat:

If you leave out the parameter description, the method signature is the less readable:

getFormattedDateString::

How to Ignore the Warning

Although it’s preferable to fix these warnings by changing your method declarations, if you want to ignore them, you can simply add the following declaration to your project’s PCH file (located in the Support Files group):

#pragma clang diagnostic ignored “-Wmissing-selector-name”

All the best!

Kevin McNeish

FourBooks

Author: iOS App Development for Non-Programmers book series
Twitter: @kjmcneish

iPhone Life Column and Blog

Hello All! Just wanted to let everyone know that I’m now a regular columnist and featured blogger for iPhoneLife magazine! I’ll still be blogging here, but you can find more of my iOS content in the magazine and in my new blog:

http://www.iPhoneLife.com/blogs/kevin-mcneish

My first blog post is about Apple’s expansion of the iBookStore into Japan and some new enhancements to iBooks and iTunes Producer.

All the best!
Kevin McNeish

FourBooks

Twitter: @kjmcneish