Dear all,
when we try to write
into the SUPBigBinary
from NSData that consist of picture data more
than 10-20k bytes, the write
method acrually writes only 1kbyte(shows
only 1022bytes) of binary
data.
Please confirm that we need to do multiple writes to
SUPBigBinary,
maybe every time opening and closing the stream as
well.
Please check the below code we are using:
UIImage *camerafile ;
@try{ camerafile = [UIImage
imageNamed:@"green checkmark
64.png"];
NSData *cameradata = [UIImagePNGRepresentation:camerafile];
long test=cameradata.length;
long long size=[cameradata.length];
long long iter= size/1000 + 1;
[FIFIDB synchronise]; //shell MBO
FIAddPictureList *returnDummies = [FIAddPicture findAll];
if ([returnDummies length] > 0)
{
for (FIAddPicture *oneRec in returnDummies)
{
FIAddPicture *fap = oneRec;
SUPBigBinary *fileContent=fap.FILE_CONTENT;
//[fileContent copyFromFile:@"green checkmark 64.png"];
[fileContent openForWrite: 0]; //SUPLong size 1000
for(int j=0; j<iter;++j)
{
[fileContent
write:cameradata];
[fileContent
flush];
}
[fileContent close];
[fap create:@"pic1"
withIV_OBJECT_ID:@"0005000002"
withIV_FILE_EXT:@"jpeg"];
[fap save];
[fap submitPending]; [FIFIDB synchronize];
break;
}
}
}
@catch (NSException *exception)
{
NSLog(@"FAILED: updating record");
NSLog(@"%@: %@", [exception name],[exception reason]);
return; }
[camerafile release];