Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning iOS Programming: Building and Deploying iOS Applications
This is the forum to discuss the Wrox book Beginning iOS Programming: Building and Deploying iOS Applications by Nick Harris; ISBN: 978-1-118-84147-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iOS Programming: Building and Deploying iOS Applications section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 27th, 2015, 04:35 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4

I am really new to this but i have been searching for a day and can't figure out what i am doing wrong. I am using Xcode version 6.1. In chapter 4 when we put in the text field and add the code in the view controller.m file, when i add self.bandobject = [[BandObject alloc] init]; it give me and error. Use of undeclared identifier and asks me if i want to try to change the name to_bandObject. Can someone tell me what i need to fix and the reason this is happening so i know how to avoid it in the future. Thanks in advance.
Here is my code

// ViewController.m
// Bands
//
//
// Copyright (c) 2015 Idea Monkey Studios. All rights reserved.
//

#import "ViewController.h"





@implementation ViewController




- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

NSLog(@"titleLabel.text = %@", self.titleLabel.text);

self.bandObject = [[BandObject alloc] init];
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
return YES;
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
self.bandObject.name = self.nameTextField.text;
[self.nameTextField resignFirstResponder];
return YES;
}

-(BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
self.bandObject.name =self.nameTextField.text;
[self saveBandObject];
[self.nameTextField resignFirstResponder];
return YES;
}



@end


//
// ViewController.h
// Bands
//
//
// Copyright (c) 2015 Idea Monkey Studios. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "WBABand.h"


@interface ViewController : UIViewController <UITextFieldDelegate>

@property (nonatomic, strong) WBABand *bandObject;
@property (nonatomic, weak) IBOutlet UILabel *titleLabel;
@property (nonatomic, weak) IBOutlet UITextField *nameTextField;

@end
  #2 (permalink)  
Old March 31st, 2015, 10:02 PM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Talking Chapter 4 P82-3

Hi
Just go to Errata and have a look at the changes for Chapter 4.
BandObject should be WBABand //p82
and remove
[self.saveBandObject]; //p83
Cheers
Wendel


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 - Code Download Missing for this Chapter dbaechtel BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 0 August 11th, 2009 11:02 AM
Chapter 2 - End of chapter exercises whizzkid1892 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 July 30th, 2008 12:02 PM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.