Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9213457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:45:16+00:00 2026-06-18T01:45:16+00:00

Whenever I create an init that has a delegate conforming to a protocol I

  • 0

Whenever I create an init that has a delegate conforming to a protocol I write the init as this:

- (id)initWithDelegate:(id<ProtocolToConform>)delegate;

This way I will have a warning if the creating object does not conform to the protocol.

However I noticed that ie UIAlertView init method looks like this:

- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...

The delegate argument does not specify to conform to the UIAlertViewDelegate protocol? Any clues why Apple has done it that way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:45:17+00:00Added an answer on June 18, 2026 at 1:45 am

    My understanding is that the API was a big mess a few years ago and they are still fixing all these issues.

    Note that until recently many protocols were informal and almost everywhere in the API you could find delegates only as an id. Apple is fixing it step by step in every version, for example formal NSURLConnection delegates came with iOS 6.0. Or note that in iOS 6.1 some of the id return types were changed into instancetype.

    Well, this was my initial idea, after checking the header files:

    @property(nonatomic,assign) id /*<UIAlertViewDelegate>*/ delegate

    It’s obvious somebody wanted to add the protocol to the declarations but added only the comment. I am guessing they left it without the protocol for compatibility.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I use permutations, I have to create a list of the permutations because
I have a need to create a HttpSession (via cookie) whenever a client invokes
I am trying to write a class that will calculate checksums using multiple processes,
Whenever I need to create a new NSString variable I always alloc and init
I'm trying to create a class that inherits NSMutableDictionary. Whenever I initialize an object
I am trying to create a window in GTK+ that has tab looks like
I have a dynamically created table, that has N rows and M QTableWidgetItems (that
I am trying to create a page that has a scroller of images and
We're using Perforce and Visual Studio. Whenever we create a branch, some projects will
Whenever I create a new project in the Visual Studio 2010 Release Candidate, for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.