Hi All,
We are facing problem to upload the image to SAP via SUP 2.1.3 from iOS native app.
With the following piece of code, we are able to send the file to SAP, but file is not visible in proper format. The size of image on SAP appears as 1KB only.
I created a Dummy MBO and put operation which does the upload image operation.
Below is the code which upload the image on SAP:
@try{
UIImage *camerafile = [UIImageimageNamed:@"helloi.jpg"];
NSData *cameraData = UIImageJPEGRepresentation(camerafile, 1);
longlong size = [cameraData length];
[FIFIDBsynchronize]; //shell MBO
FIAddPictureList *returnDummies = [FIAddPicturefindAll];
// FIAddPicture *fap;
if ([returnDummies length] > 0)
{
for (FIAddPicture *oneRec in returnDummies)
{
FIAddPicture *fap = oneRec;
SUPBigBinary *fileContent=fap.FILE_CONTENT;
[fileContent openForWrite: 0]; //13286
[fileContent write:cameraData];
[fileContent flush];
[fileContent close];
[fap create:@"helloi"withIV_OBJECT_ID:@"0005000002"withIV_FILE_EXT:@"jpg"];
[fap save];
[fap submitPending];
[FIFIDBsynchronize];
break;
}
}
}
@catch (NSException *exception) {
NSLog(@"FAILED: updating record");
NSLog(@"%@: %@", [exception name],[exception reason]);
return;
} ///////////////////////////////////////////////////////////////////////
}
Please help to resolve the issue.