I use a httpsocket to import a pdf from my server to a iPhone. I use this code:
Sub getDocument(urlDoc As Text, outputFile As Xojo.IO.FolderItem )
Declare Function CFURLCreateStringByAddingPercentEscapes Lib "Foundation" (allocator As Ptr, origString As CFStringRef, charactersToLeaveUnescaped As CFStringRef, legalURLCharactersToBeEscaped As CFStringRef, encoding As UInt32) As CFStringRef
Dim encodedURL As Text
encodedURL = CFURLCreateStringByAddingPercentEscapes(Nil, urlDoc, Nil, Nil, &h08000100)
// Call to get document
Self.Send("GET", encodedURL, outputFile)
I have another code in the " FileReceived" of the socket Event to write the imported file on the SpecialFolder.Documents of my app on the mobile device.
The document I import is a PDF file. The importation works fine.
When I open this document in my app, I call adobe acrobat reader. There is always this message that appears:
" Impossible to open this document, It is corrupted".
If I copy myself the same PDF using iTunes on the mobile device into the app, I open it using my app and it works fine.
Is there a problem when the file is imported from the server?