Note that there are some explanatory texts on larger screens.

plurals
  1. POArc Error ?? Existing ivar delegate for unsafe_unretained property
    text
    copied!<p>I am currently following the tutorials in a book that was written before the use of arc in Xcode. I have the exact same problem like what is stated here: </p> <p><a href="https://stackoverflow.com/questions/8138902/existing-ivar-delegate-for-unsafe-unretained-property-delegate-must-be-un">&#39;Existing ivar &#39;delegate&#39; for unsafe_unretained property &#39;delegate&#39; must be __unsafe_unretained</a></p> <p>The question has been answered, but is has not been stated exactly why this is the case.</p> <p>The Code in the book states that I use this code to declare member variables:</p> <pre><code>the.h File ___________ #import &lt;Cocoa/Cocoa.h&gt; @interface TestProgramDelegate : NSObject &lt;NSApplicationDelegate&gt; { NSWindow *window; NSTextField *message; } @property (assign) IBOutlet NSWindow *window; @property (assign) IBOutlet NSTextField *message; @property (assign) IBOutlet NSTextField *inputText; @end the.m file __________ #import "the.h" //File @implementation theHFileAppDelegate @synthesize window @synthesize message @synthesize inputText </code></pre> <p>When I synthesize the variables in my .m file, I get the following error message: Existing ivar 'window' for property 'window' with assign attribute must be __unsafe_unretaied.</p> <p>But when I remove the declaration of the member variables like its stated in the book, everything works fine and I don't get an error.</p> <pre><code>the.h File ___________ #import &lt;Cocoa/Cocoa.h&gt; @interface TestProgramDelegate : NSObject &lt;NSApplicationDelegate&gt; { NSWindow *window; NSTextField *message; } @property (assign) IBOutlet NSWindow *window; @property (assign) IBOutlet NSTextField *message; @property (assign) IBOutlet NSTextField *inputText; @end the.m file __________ #import "the.h" //File @implementation theHFileAppDelegate @synthesize window @synthesize message @synthesize inputText </code></pre> <p>My program works, but I want to understand why this causes trouble. Thanks a lot.</p>
 

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