Reputation: 1466
i'm currently using Xcode 4.2.1 and iOS 5. I tried using SQlite3 but i could not insert or update any data as i always get this error "attempt to write a readonly database". after searching i find that this is something related with apple that you cannot copy the database into the Documents directory to be writeable!
is there any other easy way to solve this problem or use another method of storing the data?
thanks
Upvotes: 0
Views: 241
Reputation: 9010
Word of advice: You should be saving it to library/cache directory. This is so that it's not backed up by iTunes or iCloud. I say this only because my app was rejected for this reason.
NSString *path = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
Upvotes: 1
Reputation: 8109
it is the standard way with apple devices to handle read/writeable files in documents directory only. you cannot write to any file if it is in your application resource and you must copy it to document directory to write anything to it.
Upvotes: 1
Reputation: 515
Yes, there is a much better method of storing data: Core Data. If you are interested, this is a good place to get started.
Apple has pretty much dropped almost all of the documentation on SQLite and switched over to Core Data. Core Data also has a performance boost, so there isn't a a reason not to use it.
Upvotes: 2