• 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
Warning: type 'id <NSTextAttachmentCell>' does not conform to the 'NSCopying' protocol
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Warning: type 'id <NSTextAttachmentCell>' does not conform to the 'NSCopying' protocol


  • Subject: Warning: type 'id <NSTextAttachmentCell>' does not conform to the 'NSCopying' protocol
  • From: email@hidden (Stefan Haller)
  • Date: Wed, 19 Dec 2007 15:33:15 +0100
  • Organization: Ableton

I have a piece of code that loops over all attachments in a text view
and messes with their cells.

I'm getting this compiler warning that I can't explain:

  warning: type 'id <NSTextAttachmentCell>' does not
           conform to the 'NSCopying' protocol

Why should it?  There's no 'copy' in my code.  The warning goes away if
I change the marked line to this:

  id <NSTextAttachmentCell> cell_id = [attachment attachmentCell];
  NSTextAttachmentCell *cell = (NSTextAttachmentCell*) cell_id;

Can anybody explain this to me please?

Best,
   Stefan



  unsigned end = [textStorage length];
  NSRange effectiveRange = { 0, 0 };
  while (NSMaxRange(effectiveRange) < end) {
      NSTextAttachment *attachment =
          [textStorage attribute:NSAttachmentAttributeName
                         atIndex:NSMaxRange(effectiveRange)
                  effectiveRange:&effectiveRange];
      if (attachment) {
          NSTextAttachmentCell *cell = [attachment attachmentCell];  // <-- warning here

          /* do stuff with cell */
      }
  }


--
Stefan Haller
Ableton
http://www.ableton.com/
_______________________________________________

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: Warning: type 'id <NSTextAttachmentCell>' does not conform to the 'NSCopying' protocol
      • From: John Stiles <email@hidden>
  • Prev by Date: Re: Xcode cocoa project with c++
  • Next by Date: nag screens and Spaces
  • Previous by thread: Programatically Accessing Koteri's Functionality
  • Next by thread: Re: Warning: type 'id <NSTextAttachmentCell>' does not conform to the 'NSCopying' protocol
  • Index(es):
    • Date
    • Thread