iphone - DB Wrapper Not Responding to Message? -


I'm developing iphone-sdk 2.2.1 (hence no needle cry ) .

So I'm using just one SQLit wrapper in ObjecC. My DB does a good job while talking to my Adidelgeet with Debate. I connect AppDelegate, tested INSERTING etc. I

Now, the data object, I am that I want to store in the database. I would like this event to be from a visual controller class. See some code:

The App Delegate application creates DB in the DDFinishLaunching method. DB is declared as the property of this class, so I can easily access it.

  db = [FM database database Path-to-Path: [Self-BDDPPath]];  

It works fine, I tested it. The only thing I am worried about is the property of 'DB' class. It should not be the cause of problems, should it be?

From the same application, the definition of launch method, I have tested that works by using a simple insert. This works:

  [DB initialization restriction]; [DB Performed update: Enter the "TBL data sample (INSERT) (...) value (...);"]; [Db committed];  

Now, if I just take this exact code and take it to an example method of AppDelegate, the code no longer works when we start [db start transconsation] line Press, I get the "EXC_BAD_ACCESS" error.

The flow of this call to this call: - AltViewController receives a button tap event - AltViewController states to apply the "AddSample" method to execute. - Application fails to delegate the addendum method [DB booting instruction].

Now that I have written it, I am thinking that the problem gets deabed, because the application delights the routeview loads. Maybe I'm wrong though. Anyone have any ideas?

!!!!!!!!!

Update! I have just changed my addSample method to include

  db = [FM database databaseaththpath: [Self-BDDPPath]]; If (! [Db open]) {nslog (@ "db can not be opened"); }  

and

  [db off];  

The transaction works now, a new question is: How do I open the once database I could once open to different views and view-controller ?

itemprop = "text">

If you're having trouble because you do not yet know the rules of memory management. In this situation, the database path: method gives an autoresponder object, which is dealt at the end of the run loop. Your DB pointer still indicates that invalid storage space, which is why you are seeing the EXC_BAD_ACCESS error when you try to access it later.

The good news is that memory management is really very easy to learn in cocoa. Take a look at the beginning, you should have enough information to go in. To solve this particular problem, After the creation of the object, it will be necessary to call the retention method , and it will not be required on release (if you are keeping it for the life of your application. Some of treachery was not found, but it is still good practice).


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -