Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>Relevant portion of comments</h2> <h3>Jonathan</h3> <p>Given that the problem is not just <code>.</code> vs <code>-&gt;</code>, the other main option, then, is that your viewController does contain any moles or bunnies.</p> <h3>Joe</h3> <blockquote> <p>I'm using the tutorial at <a href="http://www.raywenderlich.com/1914/how-to-save-your-app-data-with-nscoding-and-nsfilemanager" rel="nofollow">http://www.raywenderlich.com/1914/how-to-save-your-app-data-with-nscoding-and-nsfilemanager</a>. (There is code there to download.)</p> <p>Doing:</p> <pre><code>viewController-&gt;mole = loadedMoles; </code></pre> <p>says</p> <pre><code>'struct RootViewController' has no member named 'mole' </code></pre> <p>How do I add it to viewController? </p> <p>Although in the tutorial they use</p> <pre><code>NSMutableArray *loadedBugs = [ScaryBugDatabase loadScaryBugDocs]; RootViewController *rootController = (RootViewController *) [navigationController.viewControllers objectAtIndex:0]; rootController.bugs = loadedBugs; </code></pre> </blockquote> <h3>Jonathan</h3> <p>In the downloaded code (<code>ScaryBugs3/Classes/rootViewController.h</code>), the demo has:</p> <pre><code>@class EditBugViewController; @interface RootViewController : UITableViewController { NSMutableArray *_bugs; EditBugViewController *_editBugViewController; } @property (retain) NSMutableArray *bugs; @property (retain) EditBugViewController *editBugViewController; @end </code></pre> <p>Does your equivalent have 'mole' and 'bunny' properly defined? If so, I'm at a loss to help you much further.</p> <h3>Joe</h3> <blockquote> <p>I never downloaded the source code, so I didn't see any of that. Thanks, I was wondering if he might have bugs as an array instead of a bug sprite.</p> </blockquote> <h2>Not very relevant portion of answer</h2> <p>In regular C or C++ with GCC, the error message normally occurs when either:</p> <ul> <li>You use <code>structptr-&gt;member</code> and you should use <code>structvar.member</code>, or</li> <li>You use <code>structvar.member</code> and you should use <code>structptr-&gt;member</code>.</li> </ul> <p>Objective-C is close enough to C at this juncture that you probably need to review your use of <code>.</code> vs <code>-&gt;</code> notation, I believe.</p> <p>Now that your code is legible, the lines giving the error are:</p> <pre><code>viewController.mole = loadedMoles; //error viewController.bunny = loadedBunnies; //error </code></pre> <p>You probably need to use <code>viewController-&gt;mole</code> and <code>viewController-&gt;bunny</code> instead? (I'm not sure of that, but to the extent Objective-C is a superset of C, that would be a necessary change. However, it could be that Objective-C does away with the need to distinguish between <code>.</code> and <code>-&gt;</code>.)</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