Help

I have an application that allows you to take a snapshot, set the jpeg quality size (10-100%), and then send it to the server using ASIFormDataRequest (part of ASIHTTPRequest implementation). This works fine on a network connection, but on a celluar network it seems like it has been sitting there for 5-10 minutes trying to transmit image message data before a failure (even with a quality level of 10%).

Comparing this to uploading images that Twitter and Facebook apps provide (which take anywhere from 30 seconds to a minute), this is not entirely ideal. I was wondering if anyone could give me any tips on how to speed up the data transfer or control it so that I can see exactly where the problem lies.

As soon as I get back to my Mac laptop tonight, I will post a code snippet of what exactly I am doing in case this helps.

EDIT: contains a code snippet:

NSURL *url = [NSURL URLWithString:@"...upload.php"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
NSTimeInterval time = [[NSDate date] timeIntervalSince1970];
NSString *fileName = [NSString stringWithFormat:@"%d", time];
...
float compressionRate = [userAccountView getCompressionRate];
NSLog(@"Compression rate: %.1f", compressionRate);
NSData *imageData = UIImageJPEGRepresentation(imageForView, compressionRate);
[request setData:imageData withFileName:fileName andContentType:@"image/jpeg" forKey:@"userfile"];
[request setDelegate:self];
[request startAsynchronous];

Code Comment .. where I just attach the "upload" image to the view. I suggest that I could make a synchronous call, rather than asynchronous, what do you think can improve performance? I left it in such a way that at a later stage I wanted to allow the user to make other bits at boot time.

Any advice would be great :)

Thank,

Dan

EDIT:

Jesse, thanks for the comment - I added to [request setUploadProcessDelegate: self] and put in the necessary method to track the sent data, and it all seemed to send everything in order.

JosephH - "[ASIHTTPRequest setShouldThrottleBandwidthForWWAN: YES]", , "set_time_limit (0);" PHP script ( -), , , , ! .., . ATM , 0,3 , 30 , !

, 10-100 0.0-1.0, .

!

+3
1

, , , , :

 NSLog(@"imageData size = %d", [imageData length]);

NSLog, compressionRate 0,1 10%?

ASIHTTPRequest , - . ASIHTTPRequestConfig.h; 0 1. , , , .

[ASIHTTPRequest setShouldThrottleBandwidthForWWAN:YES]?

, , , - ?

( - , , )

+1

Source: https://habr.com/ru/post/1761540/


All Articles