Code error in Your First Mac App tutorial..
Code error in Your First Mac App tutorial..
- Subject: Code error in Your First Mac App tutorial..
- From: Peter Teeson <email@hidden>
- Date: Thu, 29 Dec 2011 16:38:50 -0500
I'm familiarizing myself with Xcode 4.2.1 under Lion 10.7.2 so am doing the "Your First Mac App" tutorial.
This code snippet from the tutorial is incorrect and causes an error in compilation.
if (sender == textField) { senderName = @"textField"; }…….
The error is "Use of undeclared identifier 'textField'; did you mean _textField?"
The correct code is:
if (sender == self.textField){senderName = @"textField"; }
In fact if you refer to any of the synthesized iVars such as 'window' or 'slider'
or indeed any that you care to make up for yourself (eg aardvark) the same issue occurs.
I don't know if this is a scope, language or compiler issue.
Why would one need to use self.textField?
The tutorial is in Mac OS X 10.7 Core Library > General > Your First Mac App >
Make Connections > Check your Progress > To add log statements >
3 Implement the takeFloatValueForVolumeFrom: method as follows:
I've sent feedback to the document maintainers.
In fact the final code at the end of the tutorial does not contain that code but is far simpler.
Nevertheless the code needs correction for the sake of newcomers.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden