开发者

iphone sql - data corrupted/ missing when reading

I'm using SQL to store data in my application. I read data in the app delegate and store it in an array like so.

(First I read from the database and store in aFlashcardSet and then this)

// Add the flashcardSet to the main Array
[mainSetsArray addObject:aFlashcardSet];

In my next view I then copy the data from the app delegate.

flashcardsAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
self.setsArray = delegate.mainSetsArray;

Then I pass one object from the set to the final view.

cardDetailViewController.thisCardSet = [setsArray objectAtIndex:row];

The problem is when I read the data in the final view and use to set UI elements the app crashes, the code works fine with data hard coded during the second phase and the database data is shown fine during the second phase (to populate a table view). I've tried outputting the data at all stages and it is all correct until the final view where it either crashes or shows incorrect values (file names or random letters rather than the actual text).

I have also tried to read the database data inside the final view and set it to thisCardSet but it still suffers the same problem.

Any ideas?

Thank开发者_如何学运维s.


The problem was inside one of my custom classes I wasn't using self, so I was writing.

aString = string;

Rather than -

self.aString = string;

So I was losing data down the line, feel really stupid but hope it help's someone else =].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜