Cannot specify setter 'setTitle:' for NSObject or WKInterfaceController properties

I am trying to configure WKInterfaceTable. I followed the apples. My label does not receive text, and I get this error message in the console:

Cannot specify setter 'setTitle:' for properties of NSObject or WKInterfaceController 

How can i fix this? Objective-C please. Here is my code:

.h

 #import <Foundation/Foundation.h> #import <WatchKit/WatchKit.h> @interface MainRowType : NSObject @property (strong, nonatomic) IBOutlet WKInterfaceImage *image; @property (strong, nonatomic) IBOutlet WKInterfaceLabel *title; @end 

.m

 #import "MainRowType.h" @implementation MainRowType @end 

.h

 #import <WatchKit/WatchKit.h> #import <Foundation/Foundation.h> #import "MainRowType.h" @interface WatchTableController : WKInterfaceController @property (strong, nonatomic) IBOutlet WKInterfaceTable *tableView; @property (strong, nonatomic) NSMutableArray *titleArray; @end 

.m

I call this method

 - (void)configureTableWithData:(NSMutableArray*)dataObjects { [self.tableView setNumberOfRows:[dataObjects count] withRowType:@"mainRowType"]; for (NSInteger i = 0; i < self.tableView.numberOfRows; i++) { MainRowType* theRow = [self.tableView rowControllerAtIndex:i]; NSString *titleString = [dataObjects objectAtIndex:i]; [theRow.title setText:titleString]; } } 

thanks

+5
source share
1 answer

The title property is the problem. You cannot name the property "title" in these classes. Change the name of the property and everything should be set.

+11
source

All Articles