AFNetworking totalBytesExpectedToRead - ios

I am attempting to display download progress. But the values I get for progress are not between 0 and 1.
They are:
-2394.000000
-5290.000000
-8186.000000
-11074.000000
-13970.000000
-17482.000000
-20378.000000
-21826.000000
.
.
.
-153802.000000
1.000000
I am sure the issue is with totalBytesExpectedToRead. What property does AFNetworking look for when making the download call to get the total size?

The server needs to set Content-Length in the header so expected size is known. Of course when the entire file has completed download the expected file size is known.

Related

Obtaining cropped,unskewed AND uncropped raw image when using BlinkID iOS SDK

I'm trying to capture ID scan using MicroBlink BlinkID library
I need to get both:
processed , cropped unskewed image from front and back of the ID
unprocessed raw UIImage of which front picture was processed out.
returnFullDocumentImage and encodeFullDocumentImage but I'm always getting cropped images accessing those properties:
fullDocumentFrontImage?.image
fullDocumentBackImage?.image
how to get uncropped front image of the ID?
whatever I do, I get nil when trying to access: frontCameraFrame?.image
Found it
I needed to set
blinkIdCombinedRecognizer.saveCameraFrames = true
Yes, that’s correct! By setting saveCameraFrame to true, you can obtain frontCameraFrame, backCameraFrame, and barcodeCameraFrame.
Also, if you want to extract the face image or the signature from the document, you can do that:
self.blinkIdRecognizer?.result.faceImage
self.blinkIdRecognizer?.result.signatureImage

Saving stream of bytes to file in Swift on iOS

I'm using FileHandle to write stream of bytes to the mp4 file.
My data source allows me to input bytesOffset which is basically the current size of the file (if 0 it starts from the beginning, if more then it continue to save until reaches end).
I want to implement restart functionallity, but when write gets interrupted, the file exist, but size is always 0 KB.
Do you know any way to solve this or know any library which could help me with implementing this?
You can use Shamik framework for that.

AddBinaryField always missing bytes in UnityWebRequest Post (iOS)

Unity 2019.1.9 and .12
I'm posting a WWWForm with several AddField text fields that get sent properly and also an AddBinaryField containing the bytes for an EncodeToPng image. The image arrives on the server always with missing bytes. This issue seems to only occur on iOS device and works fine in editor.
The image file bytes are saved to the iOS device photo album properly. The file size comparison for this "ground truth" image vs the one saved on server varies depending on which UnityWebRequest properties are marked explicitly as false.
With both .chunkedTransfer and .useHttpContinue set to false, the file uploaded is only 838 bytes smaller.
With no options like that set, 814 bytes smaller.
With .useHttpContinue set to false, 778 bytes smaller.

Fatal Error: Allowed Memory Size Exhausted In XAMPP

Right now I was printing all of my data into a PDF using FPDF and those data contains pictures with a large image sizes. Then my the XAMPP promt like following text below. What is the following solution in order for me to proceed printing? Is their a solution without changing the images size?
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 50933016 bytes) in C:\xampp\htdocs\techgirl\reports\fpdf.php on line 1449
Even I tried to change the memory limit in my php.ini into 900M nothing happen.
Change the memory_limit option in your php.ini to your needs.
Change the memory_limit option in your php.ini to your needs.
Then Restart the Apache server from XAMPP
Change memory_limit to -1 in php.ini. i.e memory_limit=-1
You can find php.ini file in bin/php/

How can I get the file's total size without content-length

I want to download some files and show the downloading progress with progressview. The format is currentSize/totalSize. As you know, I can get the total size using content-length of http response. However, sometimes you cannot find the attribute in headers.
So, my question is how can I get the total size of file to be download? Or is there any way to make content-length reappear in headers.
NSURLResponse has a method called -(long long)expectedContentLength
It returns the expected content length or NSURLResponseUnknownLength if the length can't be determined.
Source: Apple documentation

Resources