Tuesday, October 21, 2008

SQLite Persistent Object Update

Last night, I fixed a bunch of bugs in the SQLite Persistent Objects code. I also wrote an iPhone application that uses it to save its data, and checked the project source code into Subversion as well. I plan to write a basic tutorial around this application, but wanted to make it available for anyone who wanted to see it in action. If you check out the project from Subversion, you should get a new folder called Sample Code. The Xcode project is in there; the links from the project back to the SQLite Persistent Objct code is project-relative, so if you put the Sample Code project anywhere else but in your sqlitepersistentobjects folder, you're going to have to relink those files.

I would appreciate it if someone could try checking it out and compiling it to make sure it works. The program uses the camera, but it can be run on the simulator,the "Take Picture" just won'tt work. If you want to run the sample code on the device, you'll have to change the bundle identifier, developer identity, and developer cert, of course.



8 comments:

Alexandre said...

Hello,
I checked it out and it builds fine, debug config still has your code signing identities though.
I tested it briefly and you cant change the date it always reverts to dec 15 1990 - couldn't test the picture because tested on simulator.

I might use it in one of my projects where I was looking for some coredata like capabilities.

kimptoc said...

Hi,

Just used it and it worked just fine. Now need to work out how to mark the PK and ensure its unique :)

Is this discussed on any forum?

Thanks,
Chris

Collins' Family Blog said...
This comment has been removed by the author.
iPhone 101 said...

Great stuff! I am fairly new to Objective-C, so this persistence framework saved many, many days of work.

Question: for master detail relationships, how are the PK / FK relationships managed? An example would be person and say person hobbies... cardinality 1:M

I looked for an example, but did not find one...

kimptoc said...

Hi,

Do you want feedback on problems?

I just updated to the latest version (34, dec 18) but now my app fails on startup - could it be incompatibilities between the 2 versions?

This is my code that loads the data:

NSArray * lastUsedArr = [UserPreference findByPrefKey:@"lastUsedX"];

Here is the stack, from the BAD_ACCESS exception.


#0 0x95e158cf in CFAllocatorAllocate
#1 0x95e9560d in __CFStrAllocateMutableContents
#2 0x95e98c25 in __CFStringChangeSizeMultiple
#3 0x95ea2027 in CFStringAppend
#4 0x95ea2d63 in _CFStringAppendFormatAndArgumentsAux
#5 0x95ea44c8 in _CFStringCreateWithFormatAndArgumentsAux
#6 0x940d92e6 in -[NSPlaceholderString initWithFormat:locale:arguments:]
#7 0x940d9278 in +[NSString stringWithFormat:]
#8 0x00004ceb in -[NSString(UppercaseFirst) stringByLowercasingFirstLetter] at NSString-UppercaseFirst.m:35
#9 0x0000ae99 in +[SQLitePersistentObject resolveClassMethod:] at SQLitePersistentObject.m:845
#10 0x947c001e in _class_resolveMethod
#11 0x0000af3c in +[SQLitePersistentObject resolveClassMethod:] at SQLitePersistentObject.m:856
#12 0x947c001e in _class_resolveMethod
#13 0x0000af3c in +[SQLitePersistentObject resolveClassMethod:] at SQLitePersistentObject.m:856
#14 0x947c001e in _class_resolveMethod

snip

#58172 0x947c001e in _class_resolveMethod
#58173 0x0000af3c in +[SQLitePersistentObject resolveClassMethod:] at SQLitePersistentObject.m:856
#58174 0x947c001e in _class_resolveMethod
#58175 0x947c02d5 in _class_lookupMethodAndLoadCache
#58176 0x947d06d6 in objc_msgSend
#58177 0x00004138 in -[FirstViewController viewDidLoad] at FirstViewController.m:322
#58178 0x30c1e66e in -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:]
#58179 0x30c204b8 in -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:]

kimptoc said...

Hi,

Oh and should it support arrays of arrays?

I have an NSArray* that has entries of NSArray* of which the its entries NSString.

Thanks in advance,
Chris

JeansPilot said...

JeansPilot offers the chance to buy a large variety of men’s and women’s jeans clothing from the world famous Italian Brands.
Online jeans clothing store looks for original fashion clothing sales and clearances of worldwide known designers. We participate in fashion auctions to get the lowest possible price for Top quality Clothes, Shoes and Accessories.
Buy Jeans

h4ns said...

What youre saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. I also love the images you put in here. They fit so well with what youre trying to say. Im sure youll reach so many people with what youve got to say.

Arsenal vs Huddersfield Town live streaming
Arsenal vs Huddersfield Town live streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Notts County vs Manchester City Live Streaming
Notts County vs Manchester City Live Streaming
Bologna vs AS Roma Live Streaming
Bologna vs AS Roma Live Streaming
Juventus vs Udinese Live Streaming
Juventus vs Udinese Live Streaming
Napoli vs Sampdoria Live Streaming
Napoli vs Sampdoria Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
AS Monaco vs Marseille Live Streaming
AS Monaco vs Marseille Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Technology News | News Today | Live Streaming TV Channels