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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:53:04+00:00 2026-05-23T02:53:04+00:00

I have a bunch of MKPolygon saved in an array, but I wanted to

  • 0

I have a bunch of MKPolygon saved in an array, but I wanted to save more data than the MKPolygon class has storage for (more specifically: a notes field that describes what that polygon is). Subclassing is, for some reason, not possible, so I found the associative objects feature that is, for my purposes, good enough. This is what my .m looks like:

@implementation MKPolygon (ExtraProperties)

static char notesKey;

- (void)setNotes:(NSString *)notes {

    objc_setAssociatedObject(self, &notesKey, notes, 1);
}

- (NSString *)notes {

    return objc_getAssociatedObject(self, &notesKey);
}

My .h just declares a property for this category:

@interface MKPolygon (ExtraProperties)
@property (nonatomic, retain) NSString *notes;
@end

Setting the notes property works well, no errors and it appears to store the variable. Getting it, on the other hand, works, but gives me a warning that -notes wasn’t found in that protocol. It’s probably important to let you know that the overlay is also added as annotation, and that I get this ‘-notes not found in protocol’ error in my mapView:viewForAnnotation: method, for which the second argument is an id that conforms to the MKAnnotation protocol.

Now, I understand that it says that the MKAnnotation protocol doesn’t implement the -notes method, but I never claim it does. I’ve created a category with two extra methods (getter/setter), so if my understanding of categories is correct, -notes is now considered to be a method of MKPolygon, correct? Then why is the compiler giving me this warning?

Also noteworthy: calling the method does actually work: I get the correct results, but I don’t like having warnings in my code.

  • 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-05-23T02:53:04+00:00Added an answer on May 23, 2026 at 2:53 am

    Since it is an MKAnnotation error.. Try implimenting it in your id… something like this probably..

    id<MKAnnotation,NSObject> delegate;

    “MKAnnotation” might be the wrong thing to put, you’d have to look it up in the xcode library but that’s my best guess… good luck if it works, good-er luck if it doesn’t /: haha

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

Sidebar

Related Questions

I have a bunch of business class with autoproperties : public class A {
I have bunch of files and very file has a header of 5 lines.
I have bunch of temporal data which I want to convert to RDF format.
i have bunch of buttons within linear layout. But there is spaces buttons. I
I have to write a bunch of DTOs (Data Transfer Objects) - their sole
I have bunch of products close to 100, and each product has its own
I have bunch of data in this form xxx(xx.xx) - number of digits are
I have bunch of data objects that I populate after getting data from a
I have bunch of location (Lat, Lng) data inside my database and let's assume
I have bunch of dates in format YYYY-MM-DD But I have all year in

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.