BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-25-2009, 12:23 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Planning ahead for Upgrades - Question

Please Login to Remove!

I've noticed that when I add new properties and/or methods to the classes in my app, the app crashes. It seems as though that's because the data that's on the device (still running in the simulator) doesn't fit well with the updated class).

Can someone offer some advice on dealing with the inevitable upgrades? I really dread the thought of having to "upgrade" the data from who knows what version to the current version.

If it was always upgrading from the most recently published version to the new one, that wouldn't be too bad. But there's no way to be sure that the user has the latest version installed.

TIA!
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 10-25-2009, 08:29 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

You have to store something that indicates the version level of the data structures. Then you code will know if there is a version difference, and react accordingly.
Offline  
Old 10-25-2009, 09:17 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's that "react accordingly" part that I'm having trouble with.

If the class is different from the data in the PersistentObject, I can't just say classObject = PersistentObject.getContents() -- because that's going to cause errors.
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 10-25-2009, 11:41 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Sure you can, if classObject is the old class.

Then you transfer the data to the new object, and persist the new object.
Offline  
Old 10-25-2009, 07:21 PM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is that what the "getclass" method of the Object class is for? I was looking at that last week but found that puzzling.

I would also like to say that this site and you in particular have been so helpful to me while I learn this this stuff. It is very appreciated!
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW

Last edited by doni49 : 10-25-2009 at 07:26 PM.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.