Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting error request for member 'indexPath' in something not a structure or union when compiling
    primarykey
    data
    text
    <p>I have an app made from tableview example, and I managed to get the files of documents directory listed on the table, and also got the way for seeing it's content on the detailview, now the problem comes when I edited one file and I want to save it. I get the error: request for member 'indexPath' in something not a structure or union when I want to access indexPath.row of the table view which is on RootViewController. This is the header for DetaiViewController:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "RootViewController.h" @class RootViewController; @interface DetailViewController : UIViewController { IBOutlet UITextView *labelName; NSString *strName; } @property (nonatomic, retain) NSString *strName; @property (nonatomic, retain) UITextView *labelName; - (IBAction)saveText:(id)sender; - (IBAction)hideKeyb:(id)sender; @end </code></pre> <p>And here is the IBOutlet in where I'm having trouble:</p> <pre><code>- (IBAction)saveText:(id)sender { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *data = labelName.text; //RootViewController *rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; RootViewController *rootViewController = [RootViewController alloc] NSString *filename = [NSString stringWithFormat:@"%d.txt",rootViewController.indexPath.row+1]; NSString *wheresave = [documentsDirectory stringByAppendingPathComponent:filename]; NSData *aData = [data dataUsingEncoding:NSUTF8StringEncoding]; [aData writeToFile:wheresave atomically:YES]; } </code></pre> <p>The error is at <code>NSString *filename = [NSString stringWithFormat:@"%d.txt",rootViewController.indexPath.row+1];</code></p> <p>I think I have all the imports ok, but i'm not sure :) Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    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. 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