BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-25-2009, 12:23 AM   #1
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
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
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
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
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


NETWORK INSTRUMENT GIGASTOR- 2U (2X) XEON E5-2630- 64 GB PC3 RAM picture

NETWORK INSTRUMENT GIGASTOR- 2U (2X) XEON E5-2630- 64 GB PC3 RAM

$356.99



POSEIDON XEON D-1500 PRODRIVE TECH BOX picture

POSEIDON XEON D-1500 PRODRIVE TECH BOX

$500.00



Dell Precision T3500 Desktop 12GB Ram Intel Xeon 3.07GHz (NO OPERATING SYSTEM) picture

Dell Precision T3500 Desktop 12GB Ram Intel Xeon 3.07GHz (NO OPERATING SYSTEM)

$209.97



TYAN S5387-EFI EATX DUAL XEON LGA 771 SERVER MOTHERBOARD 2GBE 500P GFX SATA RAID picture

TYAN S5387-EFI EATX DUAL XEON LGA 771 SERVER MOTHERBOARD 2GBE 500P GFX SATA RAID

$150.00



Trenton 92-506313-XXX W/ 2x Intel Xeon Processors & 4GB DDR2 RAM picture

Trenton 92-506313-XXX W/ 2x Intel Xeon Processors & 4GB DDR2 RAM

$285.99



INTEL E5-2680V3 XEON PROCESSOR 2.50GHz picture

INTEL E5-2680V3 XEON PROCESSOR 2.50GHz

$299.99







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