I want to use same database object at Delegate file & Controller File of Custom Created databse header file which Contains object of type Sqlite3 & thee methods
like OpenDB & CreateTable & InserData.
i m right now just beginner in iphone programming so, pls Help me
app delegate file is like a global file , you just import the your Custom created database header file in app delegate , and create the object of Custom created database header file , assuming the file name is dbOperations.h
in app delegate
import it and create its object, then , do property , synthesize and that’s all.
in any view controller you just need to import your “appDelegate.h” file and make its object in view did load like
objAppdelegate = [[UIApplication sharedApplication]delegate];
and you may access your all methods and members of dbOperations.h file by
objAppdelegate.objdbOperations .
whatever you put in appdelegate will remain shared and common to entire app , all viewControllers and all classes.
your createDatabase method should be like this, and call this method when your application did finished loading method of appDelegate file.
and firing sql query like this fashion, in above code @”database.sqlite” is your db file name.