Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to load correctly my class?
    primarykey
    data
    text
    <p>I have a class defined in a an external pair of files, let's name them <em>engine.h</em> and <em>engine.m</em> . Also, it was given to me the file "engineListener.h". this is how they look:</p> <p><strong>File engine.h:</strong></p> <pre><code>@interface coreEngine: NSObject { NSString *displaydValue; id &lt;coreEngineListener&gt; listener; } -(coreEngine*)initWithListener:(id &lt;coreEngineListener&gt;) _listener; //... </code></pre> <p>File <strong>engine.m</strong></p> <pre><code>//imports here @interface coreEngine() -(Boolean) MyOperation: ... ... (etc) @end </code></pre> <p>File <strong>engineListener.h</strong></p> <pre><code>//imports here... @class coreEngine; @protocol coreEngineListener &lt;NSObject&gt; @required -(void) someVariable:(coreEngine *)source; @end </code></pre> <hr> <p>Now, in my <strong>myController.h</strong> I have this:</p> <pre><code>//... imports and include ... @interface myController : NSObject { coreEngine *PhysicsEngine; } - (IBAction)doSomething:(id)sender; </code></pre> <p>And in the <strong>myController.m</strong> this is what I have:</p> <pre><code>-(id) init { NSAutorelease *pool = [[NSAutoreleasePool alloc] init]; coreEngine *PhysicsEngine = [[coreEngine alloc] init]; [PhysicsEngine release]; [pool drain]; return self; } - (IBAction)doSomething:(id)sender { [PhysicsEngine MyOperation:Something]; } </code></pre> <p>The thing now is: the code compiles correctly, but the "[PhysicsEngine MyOperation:Something]" is doing nothing. I'm sure I'm instantiating my class wrongly. The NSObject defined in "engine.h engine.m and enginelistener.h" that I have to load was not made by me, and I have no means to modify it.</p> <p>I've tried doing some dummy/random things based on what I've seen around on the internet, without knowing 100% what I was doing. I'm not even close to be familiar with ObjectiveC or C/C++, so be gentle with me. I'm totally noob on this subject. I'm using Xcode 4, and I have also access to XCode 3.2.6</p> <p>How should I load my class properly? Any advice is welcome. Thanks</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.
 

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