Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3/4 Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(Objective-C) Get a Piece of Information from the LastErrorXmlDemonstrates how to get a bit of information from the LastErrorXml. Suppose you call ftp.DeleteRemoteFile and it fails, and the LastErrorXml property contains the XML as shown below. This example gets the content in the "statusCode" tag. <ChilkatLog> <DeleteRemoteFile> <DllDate>Dec 30 2015</DllDate> <ChilkatVersion>9.5.0.55</ChilkatVersion> <UnlockPrefix>xxx</UnlockPrefix> <Username>CHILKAT:Matt</Username> <Architecture>Little Endian; 32-bit</Architecture> <Language>Visual C++ 11.0 (32-bit)</Language> <VerboseLogging>0</VerboseLogging> <filename>[does_not_exist.txt]</filename> <deleteFile> <simplePathCommand> <simpleCommand> <sendCommand> <sendingCommand>DELE does_not_exist.txt</sendingCommand> </sendCommand> <readCommandResponse> <replyLineQP>550 Delete operation failed.</replyLineQP> </readCommandResponse> </simpleCommand> <error>Simple path command failed.</error> <statusCode>550</statusCode> <reply>550 Delete operation failed.</reply> </simplePathCommand> </deleteFile> <error>Failed.</error> </DeleteRemoteFile> </ChilkatLog>
#import "CkoFtp2.h" #import "CkoXml.h" CkoFtp2 *ftp = [[CkoFtp2 alloc] init]; BOOL success; // Any string unlocks the component for the 1st 30-days. success = [ftp UnlockComponent: @"Anything for 30-day trial"]; if (success != YES) { NSLog(@"%@",ftp.LastErrorText); return; } ftp.Hostname = @"ftp.***.com"; ftp.Username = @"***"; ftp.Password = @"***"; // Connect and login to the FTP server. success = [ftp Connect]; if (success != YES) { NSLog(@"%@",ftp.LastErrorText); return; } // Set the current remote directory to where the file is located: success = [ftp DeleteRemoteFile: @"does_not_exist.txt"]; if (success != YES) { CkoXml *xml = [[CkoXml alloc] init]; success = [xml LoadXml: ftp.LastErrorXml]; success = [xml SearchForTag2: nil tag: @"statusCode"]; if (success == YES) { NSLog(@"%@%@",@"statusCode = ",xml.Content); } return; } success = [ftp Disconnect]; |
© 2000-2016 Chilkat Software, Inc. All Rights Reserved.