I have my appdelegate set up as the delegate for the accelerometer,
@interface GLSpriteAppDelegate : NSObject <UIApplicationDelegate,
UIAccelerometerDelegate> {
I declare the method
- (void)accelerometer:(UIAccelerometer *)accelerometer
didAccelerate:(UIAcceleration *)acceleration;
I implement it in the .m file,
- (void)accelerometer:(UIAccelerometer *)accelerometer
didAccelerate:(UIAcceleration *)acceleration
{
etc. etc.
When I compile I get alerts like this,
GLSpriteAppDelegate *appDelegate = [[UIApplication sharedApplication]
delegate];
type 'id <UIApplicationDelegate>' does not conform to the
'UIAccelerometerDelegate' protocol
"didAccelerate:" is the only method in the protocol declaration, and it is
marked optional. How can appdelegate not conform? It does work. That is,
I do get method calls from the accelerometer.
Second oddity. If my implementation looks like this, note the semicolon at the
end,
- (void)accelerometer:(UIAccelerometer *)accelerometer
didAccelerate:(UIAcceleration *)acceleration;
{
etc. etc.
Everything behaves just the same. I would have thought the semicolon would be a
syntax error, but the compiler doesn't even issue an alert.
David
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]