dimanche 19 avril 2015

How to save image in sqlite using FMDB in ios?

I want to save image in my database and retrieve it when i need them, i have tried all solutions which i get through searching



[database executeQuery:@"INSERT INTO customerPresImage (cbFormFK, imageName, imagePath, imageData) VALUES (?, ?, ?, ?)", cbFormPK, [[AllFormFields sharedManager].nameSaved objectAtIndex:i], [[AllFormFields sharedManager].images objectAtIndex:i], [[AllFormFields sharedManager].actualImageData objectAtIndex:i]];


[[AllFormFields sharedManager] actualImageData]


contains nsdata object but when ever i try to execute my app got stuck at this point enter image description here


i have also tried to making that object archived but logically this doesnt make sense because i already have nsdata object in my array



NSData *data = [NSKeyedArchiver archivedDataWithRootObject:[[AllFormFields sharedManager].actualImageData objectAtIndex:i]];


P.S: I am using blob data type in sqlite. Please suggest me correction or if there is another way to get it done.


i have seen and acted upon these questions Question1


Question2


Aucun commentaire:

Enregistrer un commentaire