iPhone double oddity
iPhone double oddity
- Subject: iPhone double oddity
- From: David Rowland <email@hidden>
- Date: Fri, 18 Feb 2011 13:07:10 -0800
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@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