Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I ran into this error when trying to reference a protocol I had set up myself. </p> <p>This shows my protocol, the wrong method, and what I think is right method.</p> <pre><code>in .h // ------------------------------------ EtEmailDelegate Protocol -BEGIN- -------------------------------------- @protocol EtEmailDelegate - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error; //&lt;-- This is really just one chunk from the MFMailComposeViewControllerDelegate @end // ------------------------------------ EtEmailDelegate Protocol -END- -------------------------------------- @interface ClsEtEmail : NSObject &lt; MFMailComposeViewControllerDelegate&gt; { // owner UIViewController *myUivc; //EtEmailDelegate *myDelegate; // &lt;--- the wrong way, throw error id&lt;EtEmailDelegate&gt; *myDelegate; // &lt;-- the right way (i think) ... } @property (nonatomic, readwrite, assign) id&lt;EtEmailDelegate&gt; delegate; @end </code></pre> <hr> <p>Just for completeness, here is how I'm implementing some methods that also rely on the protocol...</p> <pre><code>in .m @synthesize delegate = myDelegate; // my static initializer +(id) objEtEmailWithUivc: (UIViewController*) theUivc delegate: (id &lt;EtEmailDelegate&gt;) theDelegate { ClsEtEmail * obj = [[[ClsEtEmail alloc] initWithlUivc: theUivc delegate:theDelegate] autorelease]; return obj; } // my normal init - (id)initWithlUivc: (UIViewController*) theUivc delegate: (id &lt;EtEmailDelegate&gt;) theDelegate { self = [super init]; if (self) { [self init_]; // my private init (not seen) self.uivc = theUivc; NSAssert([theDelegate conformsToProtocol:@protocol(EtEmailDelegate)],@"whoh - this can't is notE tEmailDelegate"); self.delegate = theDelegate; } return self; } </code></pre> <p>Hope this helps someone else.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload