on 05-01-2013 6:34 PM
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];
Hi Fiston,
I think this is a similar question to the one I have answered here. but to recap, to get your binary data to transfer you need to save your entity before setting the binary data. An example would be as follows:
StringTestData *newData = [StringTestData getInstance];
[newData save];
SUPBigBinary *text = newData.TEXT;
NSData *myData = [NSData dataWithData:someDataHere];
[text openForWrite:[myData length]];
[text write:myData];
[text close];
[newData save];
[newData submitPending];
[StringTestStringTestDB synchronize];
Hope that helps,
Brenton.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.