1
votes

I'm having a Sample.sqlite database in my app and can you help me on how to save the Sample.sqlite of my app in iCloud and how to download that SQLite file from iCloud and handling in our app

Thanks for any suggestions.


I'm trying implement ur idea of saving closed database in iCloud,but it's returning following error

Error Domain=NSPOSIXErrorDomain Code=1 "The operation couldn’t be completed. Operation not permitted" UserInfo=0x299bb0 {NSDescription=Unable to rename '/var/mobile/Applications/98E15712-5A98-439B-BED1-82A5A548CB15/Sample.app/Sample.sqlite' to '/private/var/mobile/Library/Mobile Documents/TV8M2M4B6L~com~companyName~sam/Documents/Sample.sqlite'.}

//MyCode

BOOL isCopiedToiCloud = [[NSFileManager defaultManager] setUbiquitous:YES itemAtURL:localUrl destinationURL:iCloudURL error:&error];
1

1 Answers

2
votes

From the iOS App Programming Guide:

Use Core Data if you want to store live databases in iCloud; do not use SQLite.

When Apple state this clearly not to do something, I think it's advice worth following.

The important word here is "live." If you close your connection to the SQLite database and then save a copy to iCloud I think you should be okay.