aloo
aloo

Reputation: 5389

Weird error for UIActionSheets when compiling against iPhone 3.0 OS

I recently started compiling my iPhone application against the 3.0 OS. The app worked fine when compiled against 2.2.1 however, compiling against 3.0 yields the following warning:

warning: type 'id ' does not conform to the 'UIActionSheetDelegate' protocol

This occurs on the 2nd line of the following code snippet which is in my app delegate class.

+ (PooClientAppDelegate*) instance;
{
    UIApplication* app = [[UIApplication sharedApplication] delegate]; // warning occurs here
    return (PooClientAppDelegate*)app;
}

I'm not sure where this error is coming from as it didn't appear when building against the older SDK's.

As another clue or piece of evidence, when running the app, none of the action sheets appear and instead the default choice for my actions sheets are automatically selected. I'm unsure whether this is related but sounds like a little more than a coincidence.

Any ideas whats going on here?

Upvotes: 0

Views: 367

Answers (1)

Dave DeLong
Dave DeLong

Reputation: 243146

You've got a blatant error on this line:

UIApplication* app = [[UIApplication sharedApplication] delegate];

You're getting an instance of UIApplication, requesting its delegate, and then trying to assign the delegate into a UIApplication pointer.

It should be:

id<UIApplicationDelegate> app = [[UIApplication sharedApplication] delegate];

I'm not sure it'll exactly fix your error, but it's sure not correct the way you have it. =)

Upvotes: 1

Related Questions