on 12-04-2012 8:01 AM
Hi All,
I am currently developing an application which uploads document on the backend from iOS through SUP. I am using SUPBigBinary format for the same. I am currently on SUP 2.1.3. The code that I am using is as follows:
NSData *data = UIImageJPEGRepresentation([UIImage imageNamed:@"select.png"], 0.0);
SUPBigBinary *img = nil;
[img openForWrite:[data length]];
[img write: data];
[img close];
When I put NSLog for data i get memory addresses for the Binary but, for SUPBigBinary I am getting (null) also, when I use create method and push data to back-end i get value in BigBinary as "0x".
According to me, Back-end part will come later in the picture, main issue is NSData is not getting transferred to SUPBigBinary [i.e. from data to img].
Please help me out in this, it's real urgent.
Thanks in advance.
Regards,
Saurabh
Hi Ivan & Sujith,
Thanks for your help. I have solved the issue with SUPBigBinary... There is issue with memory allocation which is solved It is very much possible to work with BigBinary. Thank you sujith for Odata way It's something very new and very helpful.
Thank you & Regards,
saurabh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.. saurbh kerkar ,
i am also facing the problem while posting image to the sup sever..
I have tried like following:
UIImage *img34 =[UIImage imageNamed:@"user.png"];
NSData *tempData34 = UIImagePNGRepresentation(img34);
@try {
SUP111Product *newData = [SUP111Product getInstance];
newData.id_ = 502;
newData.name =@"anil";
newData.description_ =@"GGGG";
newData.prod_size =@"MM";
newData.color =@"red";
int32_t qty = 2;
newData.quantity = qty;
NSNumber *aShort = [NSNumber numberWithShort:32];
newData.unit_price =aShort;
newData.picture_name =@"man.png";
SUPBigBinary *text =[SUPBigBinary getInstance]; //here i am getting error
[text openForWrite:[tempData34 length]];
[text write:tempData34];
newData.catalog_picture = text;
[text close];
[newData save];
[newData submitPending];
[SUP111SUP111DB synchronize];
}
@catch (NSException *exception) {
NSLog(@"exce: %@",[exception description]);
}
can you help me how to post image to sup server in iOS?
can you post any sample code what you did to post image to sup server?
Thanks in Advance....
Hi Saurabh,
For 2.1.3 you can use SUPRequest instead of ODP request and it should work.
Best Regards,
Sujith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saurabh,
Below is the method i use to upload images to SUP. I do not do an initialization at all and it works fine.
You should try doing this. Another question i would like to ask is:
What is the size of the image that you are uploading?
I think i read somewhere that 2.1.3 does not support streaming. SO it just might be the case that the image is too big and hence the problem. But this is just speculation.
Best Regards,
Sujith
-(IBAction)uploadStart:(id)sender
{
NSDate *uploadTimer = [NSDate date];
[imageView1 removeFromSuperview];
UIImage *image;
NSData *postData;
NSLog(@"Upload Started");
if(flag)
{
image = [UIImage imageNamed:@"The-Dark-Knight.jpg"];
postData = UIImageJPEGRepresentation (image,CGFLOAT_MIN);
flag = NO;
}
else
{
image = [UIImage imageNamed:@"witcher2.png"];
postData = UIImagePNGRepresentation(image);
flag = YES;
}
ODPRequest *postRequest2 = [ODPRequest requestWithURL:[NSURL URLWithString:@"http://ldcig8p.wdf.sap.corp:50018/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('LH')/$value"]];
[postRequest2 setRequestMethod:@"PUT"];
[postRequest2 addRequestHeader:@"Content-Type" value:@"image/jpeg"];
[postRequest2 addRequestHeader:@"X-Requested-With" value:@"XMLHttpRequest"];
[postRequest2 setPostBody:[NSMutableData dataWithData:postData]];
[postRequest2 setUsername:@"*******"];
[postRequest2 setPassword:@"*******"];
[postRequest2 startSynchronous];
if (postRequest2.error) {
NSLog(@"%@", [postRequest2.error localizedDescription]);
}
else
{
//// NSLog(@"Response String: %@",[postRequest2 responseString]);
float uploadTime = [uploadTimer timeIntervalSinceNow] * -1000.0;;
NSLog(@"The total time for upload is %fms",uploadTime);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sujith,
Thank you for the response.
I went through the code snippet you have forwarded but, if I am not wrong this works with SUP 2.2. I was checking the ODPRequest class on infocenter they document this class in SUP 2.2. So, Is it only available with SUP 2.2 or it is also there in SUP 2.1 #ESD3. My project is currently on SUP 2.1 #ESD3.
Regards,
saurabh
Hi All,
Well, I have gone a small step forward...
The issue is that Memory is not getting allocated to the SUPBigBinary object and for because of that the problem is coming....
Can someone help me out on that??
Regards,
Saurabh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.