Xcode 5 iPhone app; all my '[' and ']' match, but "parse expected ']' " still comes up
Question: i'm new and learning from a tutorial, i've coded in _python_ before so i have
mercilessly hunted for the additional '**]** ' it claims it needs… and even
when i put it in it then says, it's unexpected and want to delete it, leading
back to the original problem. it says it expects a '**]** ' on the line "**\-
(void)createOrOpenDB** " this is the view controller.m

    
    
    #import "ViewController.h"
    
    
    @interface ViewController ()
    {
        NSMutableArray *ArrayOfPowders;
        sqlite3  *powderDB;
        NSString *dbPathSring;
    
    }
    
    - (IBAction)AddPowderButton:(id)sender;
    - (IBAction)DeletePowderButton:(id)sender;
    - (IBAction)ShowAllButton:(id)sender;
    
    
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad
    
    {
        [super viewDidLoad];
        ArrayOfPowders = [[NSMutableArray alloc]init];
        [[self mytableview]setDelegate:self];
        [[self mytableview]setDataSource:self];
        [self createOrOpenDB];
    }
    
    - (void)createOrOpenDB
    
    {
        NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *docPath = [path objectAtIndex:0];
        dbPathSring = [docPath stringByAppendingPathComponent:@"powders.db"];
    
        char *error;
    
        NSFileManager *fileManager = [NSFileManager defaultManager];
        if (![fileManager fileExistsAtPath:dbPathSring]) {
            const char *dbpath = [dbPathSring UTF8String];
    
            // create db here
            if (sqlite3_open(dbpath, &powderDB)==SQLITE_OK){
                const char *sql_stmt = "CREATE TABLE IF NOT EXISTS POWDERS (ID INTEGER PRIMARY KEY AUTOINCREMENT, POWDERNAME TEXT, RALCODE INTEGER, FINISH TEXT)";
                sqlite3_exec(powderDB, sql_stmt, NULL, NULL, &error);
                sqlite3_close(powderDB);
    
            }
        }
    }
    
    
    -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    {
        return 1;}
    
    -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return [ArrayOfPowders count];
    }
    
    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"Cell";
        UITableViewCell *Cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
        if (!Cell){
            Cell = [[UITableViewCell alloc]initWithStyle:(UITableViewCellStyleSubtitle) reuseIdentifier:CellIdentifier];
    
            powder *apowder = [ArrayOfPowders objectAtIndex:indexPath.row];
    
            Cell.textLabel.text = apowder.name;
            Cell.detailTextLabel.text = [NSString stringWithFormat:@"%d",apowder.RAL];
    
            return Cell;
    
        }
    
    
    - (void)didReceiveMemoryWarning
    {
        [super didRecieveMemoryWarning];
    
    }
    
        - (IBAction)addpowderbutton:(id)sender
        {
    
            if (sqlite3_open([dbPathSring UTF8String], &powderDB)==SQLITE_OK){
                NSString *inserStmt = [NSString stringWithFormat:@"INSERT INTO POWDERS(NAME,RAL) values ('%s' '%d')",[self.nameField.text UTF8String],[self.RAlField.text intValue]];
    
                const char *insert_stmt = [inserstmt UTF8String];
    
                if (sqlite3_exec(powderDB, insert_stmt, NULL, NULL, &error)==SQLITE_OK) {
                    NSLog(@"powder added");
    
                    powder *powder = [[powder alloc]init];
    
                    [powder setname:self.namefield.text];
                    [powder setRALcode:[self.RALfield.text intValue]];
    
                    [ArrayOfPowders addObject:powder];
                }
                sqlite3_close(powderDB);
    
            }
        }
    
    
    }
    
    - (IBAction)deletepowderbutton:(id)sender {
    
        sqlite3_stmt *statement;
    
    
    }
    
    - (IBAction)showallpowdersbutton:(id)sender {
    }
    
    - (IBAction)AddPowderButton:(id)sender {
    }
    
    - (IBAction)DeletePowderButton:(id)sender {
    }
    
    - (IBAction)ShowAllButton:(id)sender {
    }
    @end
    

viewcontroller.h is;

    
    
    #import <UIKit/UIKit.h>
    #import "sqlite3.h"
    #import "powder.h"
    
    @interface ViewController : UIViewController<UITableViewDataSource, UITableViewDelegate>
    
    @property (weak, nonatomic) IBOutlet UITextField *namefield;
    @property (weak, nonatomic) IBOutlet UITextField *RALfield;
    @property (weak, nonatomic) IBOutlet UITableView *mytableview;
    // items on main storyboard are give properties here
    
    
    @end
    


Answer: On the method `createOrOpenDB` you are missing a closing `}` all you need to
do is add it at the end like below (As long as this isn't a typo on the
copying over to here)

    
    
    - (void)createOrOpenDB 
    {
        NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,     NSUserDomainMask, YES);
        NSString *docPath = [path objectAtIndex:0];
        dbPathSring = [docPath stringByAppendingPathComponent:@"powders.db"];
    }
    

**UPDATE**

Just because of how you have named `ArrayOfPowders` we can tell you aren't
familiar with coding conventions so I am going to include [Apples Programming
with Objective-c conventions
documentation](https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/Conventions/Conventions.html)
that I would recommend you have a read of as it will provide a better
understanding of when to use uppercase and lowercase, method names, variable
names etc

