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 7765247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:07:14+00:00 2026-06-01T15:07:14+00:00

Note: This is similar to this question but it is not the same. I

  • 0

Note: This is similar to this question but it is not the same. I promise.

I have a series of table views that call upon a modal view for sorting the table’s contents. To do this, I set up a simple protocol in one table view controller’s header file and it worked great. I then copied this protocol over to my other table view controllers and got this warning:

Duplicate protocol definition of ‘ModalViewDelegate’ is ignored

Now I realize it is just a warning, but I would rather not see it every time I compile. To get rid of the warnings, I imported the header file in which the protocol was originally defined. Once again, I was not completely satisfied. It seems sloppy to import the header file to every table view just so I can use the protocol without warnings.

If you have read this far, I thank you. My questions are ‘Why is this happening? Is there a better way of getting rid of this warning while still using the same protocol?’

  • 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-01T15:07:15+00:00Added an answer on June 1, 2026 at 3:07 pm

    Is there a better way of getting rid of this warning while still using the same protocol?

    The compiler needs to know about the protocol in order for you to refer to it. There’s two ways you can make that happen: import the header where the protocol is declared into the files where you’re using it, or make a forward declaration of the protocol in those files: @protocol MyProtocol;. The second is really only useful when protocols need to refer to each other (to avoid circular imports); if a class needs to adopt the protocol, it needs to see the declarations of the methods in the protocol, which means it needs to see the protocol declaration itself, i.e., the header.

    It seems sloppy to import the header file to every table view just so I can use the protocol without warnings.

    This is not sloppy, it’s the way things work. It sounds like it may make sense for you to put the protocol declaration into its own header and import that wherever it’s needed.

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

Sidebar

Related Questions

Note: This is similar, but not quite the same as this other question I've
[Note: This question is very similar, but not quite the same.] I'm trying to
I'll preface this question with the note that I have looked at this similar
[NOTE: This questions is similar to but not the same as this one .]
SQL Server 10, .NET, C# This is similar to this question but not exactly
Note: I've asked this question in a similiar format on superuser but it seems
Note: This question has broadened in scope from previous revisions. I have tried to
This question may expose my ignorance as a web developer, but that wouldn't exactly
Note: This question is similar to How to prevent the copy of XML documentation
Yes, I know this seems like the same question yet again, but give me

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.