atlas
atlas

Reputation: 411

iOS app development - property not found on object

Just started using XCode to try to make iOS applications. I tried to complete Apple's own tutorial (A to-do list). It went very well until the last step/s here:

https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/ThirdTutorial.html#//apple_ref/doc/uid/TP40011343-CH10-SW1

I connected the Save and Cancel buttons to the AddToDoItemViewController (Control n drag).

Then, when i want to tell AddToDoItemViewController to create an item only when the user taps the Save button, i got errors.

I tried to write this method in ToDoListTableViewController.m

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if (sender != self.saveButton) return;
    if (self.textField.text.length > 0) {
        self.toDoItem = [[ToDoItem alloc] init];
        self.toDoItem.itemName = self.textField.text;
        self.toDoItem.completed = NO;
    }
}

8 issues appear. For example, in the first if-statement: "Property 'saveButton' not found on object of type ToDoListTableViewController*".

Also a similar issue just under it but instead of "saveButton" it says "textField". I did the imports as suggested.

Help appreciates!

Thanks.

Upvotes: 0

Views: 149

Answers (1)

Josh
Josh

Reputation: 63

There is an error in the tutorial documentation.

Where https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/ThirdTutorial.html says that you should "In the project navigator, select ToDoListTableViewController.m." you really should be following those steps in "AddToDoItemViewController.m".

So just drop that code block in 'AddToDoItemViewController.h' instead of 'ToDoListTableViewController.m'.

Upvotes: 3

Related Questions