• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
iPhone double oddity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: iPhone double oddity
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: NSDistributedNotificationCenter questions.
  • Next by Date: RE:Trouble with design pattern
  • Previous by thread: Re: NSDistributedNotificationCenter questions.
  • Next by thread: Re: iPhone double oddity
  • Index(es):
    • Date
    • Thread