• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Objective-C
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A convenient FTP request library for iOS and Mac OS X using Objective-C programming language. Support progress tracking, Breakpoint continuingly etc.

LxFTPRequest

Installation

Only need add LxFTPRequest.h and LxFTPRequest.m to your project.

Introduction

    A convenient FTP Request library. Support progress tracking, Breakpoint continuingly etc.
    Support FTP get resource list, download file, update file, 
    create directory or file, delete directory or file etc.
    Support progress tracking, Breakpoint continuingly, 
    auto check legitimacy of ftp address and local file path functions and so on.

Support

    Both support iOS and Mac OS X platforms.
    Minimum support iOS version: iOS 5.0
    Minimum support OS X version: Mac OS X 10.7

Podfile

    pod 'LxFTPRequest', '~> 1.1.2'

How to use

    #import "LxFTPRequest.h"

Get resource list:

    LxFTPRequest *request = [LxFTPRequest resourceListRequest];
    request.serverURL = [[NSURL URLWithString:FTP_SCHEME_HOST]URLByAppendingPathComponent:SUB_DIRECTORY];
    request.username = USERNAME;
    request.password = PASSWORD;
    request.progressAction = ^(NSInteger totalSize, NSInteger finishedSize, CGFloat finishedPercent) {
        NSLog(@"totalSize = %ld, finishedSize = %ld, finishedPercent = %f", totalSize, finishedSize, finishedPercent); 
    };
    request.successAction = ^(Class resultClass, id result) {
        NSArray *resultArray = (NSArray *)result;
        NSLog(@"resultArray = %@", resultArray);  
    };
    request.failAction = ^(CFStreamErrorDomain domain, NSInteger error, NSString *errorMessage) {
        NSLog(@"domain = %ld, error = %ld", domain, error);
    };
    [request start];

Download resource:

    /**
        To implement breakpoint continuingly, you only need to guarantee
        the file downloaded part has not been modified in any way, 
        the ftp server support breakpoint continuingly
        and the file on server not change. 
        The download will continue from the last time progress.
        If you want to download resource from begin, you should delete the local downloaded part.
        [[NSFileManager defaultManager]removeItemAtPath:LOCAL_FILE_PATH error:&error];
    */

    LxFTPRequest *request = [LxFTPRequest downloadRequest];
    request.serverURL = [NSURL URLWithString:FTP_RESOURCE_ADDRESS];
    request.localFileURL = [NSURL fileURLWithPath:LOCAL_FILE_PATH];
    request.username = USERNAME;
    request.password = PASSWORD;
    request.progressAction = ^(NSInteger totalSize, NSInteger finishedSize, CGFloat finishedPercent) {
        NSLog(@"totalSize = %ld, finishedSize = %ld, finishedPercent = %f", totalSize, finishedSize, finishedPercent); 
    };
    request.successAction = ^(Class resultClass, id result) {
        NSLog(@"resultClass = %@, result = %@", resultClass, result);  
    };
    request.failAction = ^(CFStreamErrorDomain domain, NSInteger error, NSString *errorMessage) {
        NSLog(@"domain = %ld, error = %ld", domain, error);
    };
    [request start];

Upload resource:

    LxFTPRequest *request = [LxFTPRequest uploadRequest];
    request.serverURL = [NSURL URLWithString:FTP_SCHEME_HOST]URLByAppendingPathComponent:FILE_PATH];
    request.localFileURL = [NSURL fileURLWithPath:LOCAL_FILE_SAVE_PATH];
    request.username = USERNAME;
    request.password = PASSWORD;
    request.progressAction = ^(NSInteger totalSize, NSInteger finishedSize, CGFloat finishedPercent) {
        NSLog(@"totalSize = %ld, finishedSize = %ld, finishedPercent = %f", totalSize, finishedSize, finishedPercent); 
    };
    request.successAction = ^(Class resultClass, id result) {
        NSLog(@"resultClass = %@, result = %@", resultClass, result);
    };
    request.failAction = ^(CFStreamErrorDomain domain, NSInteger error, NSString *errorMessage) {
        NSLog(@"domain = %ld, error = %ld", domain, error);
    };
    [request start];

Create file or directory on ftp server:

    LxFTPRequest *request = [LxFTPRequest createResourceRequest];
    request.serverURL = [NSURL URLWithString:FTP_RESOURCE_PATH];    // directory path should be end up with '/'
    request.username = USERNAME;
    request.password = PASSWORD;
    request.successAction = ^(Class resultClass, id result) {
        NSLog(@"resultClass = %@, result = %@", resultClass, result);
    };
    request.failAction = ^(CFStreamErrorDomain domain, NSInteger error, NSString *errorMessage) {
        NSLog(@"domain = %ld, error = %ld", domain, error);
    };
    [request start];

Delete file or directory on ftp server:

    /**
        CANNOT DELETE EMPTY DIRECTORY!!!
    */
    LxFTPRequest *request = [LxFTPRequest destoryResourceRequest];
    request.serverURL = [NSURL URLWithString:FTP_RESOURCE_PATH];
    request.username = USERNAME;
    request.password = PASSWORD;
    request.successAction = ^(Class resultClass, id result) {
        NSLog(@"resultClass = %@, result = %@", resultClass, result);
    };
    request.failAction = ^(CFStreamErrorDomain domain, NSInteger error, NSString *errorMessage) {
        NSLog(@"domain = %ld, error = %ld", domain, error);
    };
    [request start];

Be careful

Demo must config FTP address, username, password correctly.

License

LxFTPRequest is available under the Apache License 2.0. See the LICENSE file for more info.

More Repositories

1

macOS_Development_Tutorials_translation

Translation of macOS development tutorials.
1,280
star
2

LxGridView

Imitation iOS system desktop icon arrangement and interaction by UICollectionView!
Objective-C
972
star
3

LxDBAnything

Automate box any value! Print log without any format control symbol! Change debug habit thoroughly!
Objective-C
431
star
4

LxThroughPointsBezier

A funny iOS library. Draw a smooth bezier through several points you designated. The curve‘s bend level is adjustable.
Objective-C
397
star
5

LxThroughPointsBezier-Swift

An ideal iOS library using swift programming language. Draw a smooth curve through several points you designated. The curve‘s bend level is adjustable.
Swift
234
star
6

LxTabBarController

Inherited from UITabBarController. LxTabBarController add a powerful gesture that you can switch view controller by sweeping screen from left to right or right to left.
Objective-C
225
star
7

LxGridView-swift

Imitation iOS system desktop icon arrangement and interaction by UICollectionView!
Swift
162
star
8

Troubles-of-realizing-download-module

实现项目下载需求时遇过的那些坑
152
star
9

LxTabBadgePoint

Easily custom viewController's tabBar badge view.
Objective-C
117
star
10

LxTabBarController-swift

Inherited from UITabBarController. To change UITabBarController interactive mode, LxTabBarController add a powerful gesture you can switch view controller by sweeping screen from left the right or right to left.
Swift
77
star
11

LxKeychain

Manage your username and password for iOS and OS X platform. Highly encryption and won't be lose even you uninstall your app.
Objective-C
55
star
12

Dreamy_download_manage_solution

续言关于下载管理的探讨
19
star
13

The-strategy-of-building-a-method

论构造方法的方法论
18
star
14

LxKeychain-swift

Swift
18
star
15

LxVolumeManager

Control and observe iOS system volume.
Objective-C
17
star
16

LxPDFParser

A delightful iOS library. Simply parse the PDF file's structure. The foundation to come true more complicated functions.
Objective-C
16
star
17

LxIAPManager

Apple IAP capsulation.
Objective-C
15
star
18

FauxPas_document_translation

10
star
19

LxNavigationController

A convenient navigationController inherited from UINavigationController. LxNavigationController add a powerful gesture you can pop view controller only if you sweep the screen from left the right.
Objective-C
10
star
20

LxGitHubStarCounter

Calculate user's total star.
Python
9
star
21

LxProjectTemplate

As this repo's name.
Objective-C
8
star
22

Android-Development-Tutorials-translation

Translation of Android development tutorials.
7
star
23

LxIAPManager-swift

Apple IAP capsulation.
Swift
7
star
24

LxHTTPManager

适用于项目实践的网络请求管理封装
Objective-C
7
star
25

LxLabel

An evolutional label inherited from UILabel. It can generate a large number of effect, and use simple properties to set.
Objective-C
6
star
26

clang_static_analyzer_document_translation

6
star
27

LxTabBadgePoint-swift

Easily custom viewController's tabBar badge view.
Swift
6
star
28

LxOCCodeCleaner

Clean Objective-C code.
Shell
4
star
29

xctool_document_translation

4
star
30

LxWaveLayer

Easily add wave animation.
Objective-C
3
star
31

LxPropertyDefaultValue

Setup any custom object properties default value easily.
Objective-C
3
star
32

LxDragToDismissBadgeLabel

Objective-C
2
star
33

LxKVO

Objective-C
2
star
34

LxDownloadTask

个人认为理想的下载任务对象的模型,暂尚未具体实现
Objective-C
2
star
35

LxAppleOfficialFontManager-swift

Swift
2
star
36

LxApplication

A feature-rich application help class inherited from UIApplication.
Objective-C
2
star
37

LxSandBoxNavigator

Simply show the directory's structure by tableView tree.
Objective-C
2
star
38

LxProjectTemplate-Swift

As the repo's name.
Swift
2
star
39

LxNavigationController-swift

A convenient navigationController inherited from UINavigationController. LxNavigationController add a powerful gesture you can pop view controller only if you sweep the screen from left the right.
Swift
2
star
40

LxBigFileDigger

Find big files.
Shell
2
star
41

Notes

notes
1
star
42

charles_documentation_translation

Charles documentationtranslation
1
star
43

LxGlobalTimerManager

1
star
44

safety_in_swift_translation

1
star
45

LxWaveLayer-swift

Easily add wave animation.
Swift
1
star
46

LxAppleOfficialFontManager

Objective-C
1
star
47

xed_document_translation

1
star
48

LxGetMacIP

Shell
1
star