I've been working this problem for a week and cannot determine the cause of the file in the File.DirDocuments folder is not found.
Here is log:
Copying updated assets files (3)
Application_Start
[objEA_onInitialized]bjEA
[objEA_onClose]
Application_Active
file was uploaded successfully
Description: NSMapTable {
}
Requested file in DirDocuments: 20181211AM_001.plt
Contents of file: 32.9738028, -96.7208996, 0, 636, 43445.6524074, 2018-12-11, 15:39:27
Listing of files on FTP server:
20181210AM_001.plt
20181210PM_001.plt
20181211AM_001.plt
20181211PM_001.plt
APPE, Reply =Error: /var/mobile/Containers/Data/Application/C24DE70A-0251-4B5D-9F37-0C730F411B5F/Documents/20181211PM_001.plt: No such file or directory
Error: /var/mobile/Containers/Data/Application/C24DE70A-0251-4B5D-9F37-0C730F411B5F/Documents/20181211PM_001.plt: No such file or directory
And the pertinent code:
Here is log:
Copying updated assets files (3)
Application_Start
[objEA_onInitialized]bjEA
[objEA_onClose]
Application_Active
file was uploaded successfully
Description: NSMapTable {
}
Requested file in DirDocuments: 20181211AM_001.plt
Contents of file: 32.9738028, -96.7208996, 0, 636, 43445.6524074, 2018-12-11, 15:39:27
Listing of files on FTP server:
20181210AM_001.plt
20181210PM_001.plt
20181211AM_001.plt
20181211PM_001.plt
APPE, Reply =Error: /var/mobile/Containers/Data/Application/C24DE70A-0251-4B5D-9F37-0C730F411B5F/Documents/20181211PM_001.plt: No such file or directory
Error: /var/mobile/Containers/Data/Application/C24DE70A-0251-4B5D-9F37-0C730F411B5F/Documents/20181211PM_001.plt: No such file or directory
And the pertinent code:
B4X:
Sub Process_Globals
Private strPLTFileLines As String
Private strPLTFileName As String
End Sub
Private Sub LocManager_LocationChanged (location1 As Location)
strPLTFileName = strPLTFileName & "_001" & ".plt"
Dim s As String
File.WriteString(File.DirDocuments, strPLTFileName, strPLTFileLines)
Dim mList As List
mList = File.ListFiles(File.DirDocuments)
s = mList.Get(6)
Log("Requested file in DirDocuments: " & s)
s = File.ReadString(File.DirDocuments, strPLTFileName)
Log("Contents of file: " & s)
Dim MyCommand As Object
'Get a file listing on the FTP server folder
FTP.List("/")
Wait For FTP_ListCompleted(ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
'FTP Send Append command
s = File.DirDocuments & strPLTFileName
FTP.SendCommand("APPE", s)
Wait For (MyCommand) FTP_CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String)
If Success Then
hd.ToastMessageShow("Message Sent", True)
Else
hd.ToastMessageShow("Sending Message FAILED!", True)
End If
If Success Then
Log("file was uploaded successfully")
Else
Log("Error uploading file")
End If
End Sub
Sub FTP_CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String)
Log(Command & ", Reply =" & ReplyString)
If Success = False Then Log(LastException.Message)
End Sub
Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
Log("Listing of files on FTP server:")
For i = 0 To Files.Length - 1
Log(Files(i).Name)
Next
If Success = False Then Log(LastException.Message)
End Sub