Understanding iOS Compiler Warnings – Prototype Cells Must Have Reuse Identifiers

Prototype Cells Must Have Reuse Identifiers You will get this warning if you add a table view controller to a storyboard. By default, a table view uses prototype cells, and since no reuse identifier has been specified immediately after you add the table view controller, you get this warning. To fix this problem, select the table cell (not the table view), go to the Properties Inspector and set the Identifier to Cell, or some other descriptive text. In the table view controller’s tableView:cellForRowAtIndexPath: method, you can use the identifier to reference the cell and use it as a prototype to … Continue reading Understanding iOS Compiler Warnings – Prototype Cells Must Have Reuse Identifiers

Understanding iOS Compiler Warnings – Initializer Element Is Not a Compile-Time Constant

Initializer Element Is Not a Compile-Time Constant You usually get this compiler error if you try to assign a non-constant value to an instance variable. For example, you will get this error if you place the following code outside of a class method: NSArray *devices = [[NSArray alloc]                              initWithObjects:@”iPod Touch”                              @”iPhone”,                              @”iPad”, nil]; Although you can do this in other languages, you can’t do it in Objective-C. To fix the problem, declare the instance variable without initializing it: NSArray *devices; Then initialize the instance variable elsewhere, such as in a view controller’s viewDidLoad … Continue reading Understanding iOS Compiler Warnings – Initializer Element Is Not a Compile-Time Constant

Understanding iOS Compiler Errors – Expected ‘;’ after method prototype

Expected ‘;’ after method prototype You usually get this error in a class header file method declaration if you forget to put a colon (not a semicolon) before a parameter. For example, there is a colon missing after addToTotal, the method name: – (double) addToTotal(double)value; To fix the problem, just add a colon before the parameter: – (double) addToTotal:(double)value; ———————————————————————————————————————————————————————- For explanations of other compiler errors and warnings, check out our new book site: http://www.iOSAppsForEveryone.com Kevin McNeish Eight-time .NET MVP Recipient Apple iOS Author, Trainer http://www.iOSAppsForEveryone.com 

Understanding iOS Compiler Errors – Missing sentinel in method dispatch

Missing sentinel in method dispatch You usually get this warning when you forget to put a nil at the end of your argument list when calling methods such as NSArray’s initWithObjects: NSArray *choices = [[NSArray alloc]                      initWithObjects:                      @”Upper Case”,                      @”Lower Case”,                      @”Capitalized”];  To correct this problem, just add a nil to the end of the list: NSArray *choices = [[NSArray alloc]                         initWithObjects:                         @”Upper Case”,                         @”Lower Case”,                         @”Capitalized”,                         nil]; For explanations of other compiler errors and warnings, check out our new book site: http://www.iOSAppsForEveryone.com Kevin McNeish Eight-time .NET MVP Recipient … Continue reading Understanding iOS Compiler Errors – Missing sentinel in method dispatch

Understanding iOS Compiler Errors – Interface type cannot be statically allocated

Interface type cannot be statically allocated You usually get this error when you forget to include an asterisk before a variable name this is an object pointer: UILabel label = [[UILabel alloc] init]; To correct this problem, just add a asterisk before the variable name: UILabel *label = [[UILabel alloc] init]; This is a common mistake for developers coming from other languages such as C# or Java. For explanations of other compiler errors and warnings, check out our new book site: http://www.iOSAppsForEveryone.com Kevin McNeish Eight-time .NET MVP Recipient Apple iOS Author, Trainer http://www.iOSAppsForEveryone.com 

iOS App Development for Everyone

Well, it’s been a while since my last blog post, but I wanted to let all of you lurkers know I’m about 80% complete with my upcoming book “iOS App Development for Everyone”! Many of my .NET friends and associates are very interested in iOS development, so I’ll be posting information here in my MSMVP blog as well as on our book site. This book’s intended audience is BOTH developers and non-developers. Apple’s software development tools are finally at a point where people who have never written code before can create iOS Apps. My wife Sharlene is one of the … Continue reading iOS App Development for Everyone