Git Product home page Git Product logo

blackraccoon's Introduction

BlackRaccoon

IOS FTP Client Code

THIS FIRMWARE NO LONGER IN ACTIVE DEVELOPMENT NOR IS IT SUPPORTED.

PLEASE USE EITHER A FORK OR A MORE ROBUST VERSION OF FTP.

BLACKRACCOON WAS A NON-SECURE METHOD OF FTP USING APPLE'S INTERNAL FUNCTIONS THAT HAVE SINCE BEEN DEPRECATED/REMOVED.

Thank you to the many that have used BlackRaccoon and have forked the project. I hope that it lives on... just with someone else!

Please note: I have NOT put BlackRaccoon into the Public Domain and STILL retain all copyright. If you feel the need to use it from another fork, please assure that the copyright notice remains INTACT.

Thank you!

blackraccoon's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blackraccoon's Issues

how to upload an image

i just can't figure out how to upload an image to the server, i tried everything and nothing works even the project added in the BR zip didn't work

Incomplete uploads with no error

I have the same problem as issues #14 and #9:

When uploading files, they are often only partially uploaded, however I get a requestCompleted: delegate callback instead of a requestFailed: delegate callback.

From what you have said in the other two issues, this can probably be fixed by passing smaller "chunks" in requestDataToSend:. However when sending the entire file this should at the very least, result in the requestFailed: delegate method being called when it does not upload the entire file, but should probably be fixed so that it works, especially since this is the example code that you give for us to use.

Unknown error after 5 minutes inactive

Hi, Lloyd,

I am with the same problem using your code, with the same error, in the same line and after 5 minutes inactive: Unable to complete two download requests in a row #3.

2014-03-03 16:52:54.187 DHL[1855:70b] -[BRRequestListDirectory stream:handleEvent:] [Line 243] Unknown error!

Do I need to implement something more? I just implemented like your documentation.

downloaded file's size always 0

hi

however it says transfer completed my file's length always 0
my files's actual size is 53kb
my code is below:
downloadData = [NSMutableData dataWithCapacity: 1];

        downloadFile = [[BRRequestDownload alloc] initWithDelegate:self];
        downloadFile.hostname = @"ftp.xxxx.com";
        downloadFile.path = @"/xxxxx/LifeStyle.sqlite";
        downloadFile.username = @"xxxx";
        downloadFile.password = @"xxxx";

        [downloadFile start];

what am i doing wrong?

BRRequestDownload receivedData are empty

Hello.

I try to download a file which (i'm sure) exist on the FTP but my saved file is empty.

In the requestCompleted callback, i do that is in the doc.

NSData *data = downloadFile.receivedData;
NSLog(@"RECEIVED: %d", [data length]);

So i display the length but it is always 0.

If i try to download a file which is not exist, there is an error. So the program find my file but i think can't download it.

But it's weird because when i start the download, i see my downflow increased..

Hope i'm clear.

Thank you !

Latest code doesn't compile

RBRequest.h declares the 'credentials' property. It's not implemented anywhere.

BRRequestQueue.h declared the 'queueDelegate' property. It's not synthesized or implemented anywhere.

Improved support for uploading/downloading large files

The current implementation of the upload and download requests require that the entire file be put into memory as an NSData object. This approach doesn't work when dealing with large files that don't fit in memory.

I have updated my local copy of BlackRaccoon that adds a 'path' property to BRRequestUpload and BRRequestDownload. If set, the code sets up an NSFileHandle to the local files and performs the data transfers directly on the files without the need to load the entire file as an NSData object.

If you would like the code for these update please let me know. I know little about git so I have no idea what is the best way to get you the files.

NSStreamEventNone

getting compile warning : NSStramEventNone not handled in switch!

Delete remote file

Hi guys.
First of all. BlackRaccoon is amazing. Thanks for your code.
Second I have a problem deleting a file on my ftp-server.
I get the Error: <BRRequestDelete: 0x10bbea6e0> Can't delete file or directory.
What can be the reasons?
Thanks!

kCFFTPResourceModDate reporting wrong date

Hi, this is a really useful ftp program, thanks.

I am have one issue however. I am iterating though a load of files stored locally on a device, and comparing the date modified with the date modified on a server (to replace if necessary). However, the UTC date returned by kCFFTPResourceModDate is an hour out!? It reports an hour earlier than it should. I've checked the server and it is at the correct time.

E.g The files were last update on the device at 13.30 GMT BST (12.30 UTC). I then update the files on the server at 14.00 GMT BST (13.00 UTC). When I compare the files, the date of the files on the device are 12.30 UTC, but kCFFTPResourceModDate reports that the files on the server were last modified at 12.00 UTC. What is happening here? Is there anything I can do?

Update - using an NSURLRequest and 'objectForKey:@"Last-Modified"' on the response, I do get the correct date (13.00 UTC in the example above)..so it must be some sort of bug?

Thanks

Crashing on BRStreamInfo openRead

I'm having an issue using BRRequestListDirectory. I am not with an ARC project, and I keep having a crash when I try to list all my directories on "[readStream open];" in "- (void)openRead:(BRRequest *)request".

My code is the following:

    if (listDirFTP)
        [listDirFTP release];

    listDirFTP = [[BRRequestListDirectory alloc] initWithDelegate:self];

    listDirFTP.hostname = self.hostString;
    listDirFTP.username = self.usernameString;
    listDirFTP.password = self.passwordString;

    listDirFTP.path = self.distantPath;

    [listDirFTP start];

Do you have any ideas on what it could be ??

Thanks!!

What about encoding ?

Is it possible to tell BR to return elements in UTF8 Encoding for example ?? Because it can be different depending on server's encoding ! I have one in UTF8 and one in WindowsLatin...

Thanks

Creating directory issues

how to create a directory ? i can enable all the permission in Ftp but i can`t create . Can you please help me.

Create a tag for cocoapods

Hi! Can you create a tag with the current version of blackracoon so I can make a podspec and push it to cocoapods main repo?

Unable to download multiple files on the same directory

Hi! I'm unable to download multiple files in the same directory. Here the steps i'm doing:

  1. Listed directory files and put them in a NSMutableArray;
  2. Made a "for loop" to read the NSMutableArray and download each file;

When a download only one file it works fine.

Crashes on [readStream open];

In the BRStreamInfo.m i keep getting EXEC_BAD_ACCESS called (somewhat randomly) on the [readStream open] call. Usually after 4th test.

readStream.delegate = request;
[readStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[readStream open];

My own code is very huge and I can provide only part where I open up an instance and use BR:
downloadData = [NSMutableData dataWithCapacity: 1];
downloadFile = [[BRRequestDownload alloc] initWithDelegate:self];
downloadFile.hostname = @"ftpIP";
downloadFile.path = @"/Download/Tunes2.docx";
downloadFile.username = @"login";
downloadFile.password = @"pass";
[downloadFile start];

After file is downloaded, I download another 4 and then uploading another 5, one after one with help of this code:
uploadFile = [[BRRequestUpload alloc] initWithDelegate:self];
uploadFile.path = @"/Upload/Tunes2.docx";
uploadFile.hostname = @"ftpIP";
uploadFile.username = @"login";
uploadFile.password = @"pass";
[uploadFile start]

When test ends. After that I'm making the same things couple of times and I receive BAD_ACCESS.

Error after complete message

schermata 2013-08-22 alle 16 41 00

Hi,

after the complete message i got the error in attachment, i'm using iOS7 I don't know if this can cause some error.
There is a way to fix it?

Below the code used to upload the file:

uploadFile = [[BRRequestUpload alloc] initWithDelegate:self];

NSString *applicationDocumentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filepath = [NSString stringWithFormat: @"%@/%@", applicationDocumentsDir, pdfFile];
uploadData = [NSData dataWithContentsOfFile: filepath];

//----- for anonymous login just leave the username and password nil
//uploadFile.sentData = dataToUpload;
NSString * filename = [NSString stringWithFormat:@"%@%@%@", @"/Firma/", self.textDdtNumb.text, @".pdf"];
uploadFile.path = filename;
uploadFile.hostname = @"xxx.xxx.xxx.xxx";
uploadFile.username = @"username";
uploadFile.password = @"password";

//we start the request
[uploadFile start];

-(void) requestCompleted: (BRRequest *) request
{
//----- handle Create Directory

//----- handle Download File
if (request == uploadFile)
{
    NSLog(@"%@ completed!", request);
    uploadFile = nil;
    uploadData = nil;

}

}

-(void) requestFailed:(BRRequest *) request
{

if (request == uploadFile)
{
    NSLog(@"%@", request.error.message);

    uploadFile = nil;
}

}

  • (NSData *) requestDataToSend: (BRRequestUpload *) request
    {
    //----- returns data object or nil when complete
    //----- basically, first time we return the pointer to the NSData.
    //----- and BR will upload the data.
    //----- Second time we return nil which means no more data to send
    NSData *temp = uploadData; // this is a shallow copy of the pointer

    uploadData = nil; // next time around, return nil...

    return temp;
    }

-(BOOL) shouldOverwriteFileWithRequest: (BRRequest *) request
{
//----- set this as appropriate if you want the file to be overwritten
if (request == uploadFile)
{
//----- if uploading a file, we set it to YES
return YES;
}

//----- anything else (directories, etc) we set to NO
return NO;

}

Required delegate method shouldOverwriteFileWithRequest: not being called when uploading files

When using BRRequestUpload, the delegate method shouldOverwriteFileWithRequest: is never being called.

Tracked down to BRRequestListDirectory.m, - method fileExists:

fileNamePath is never used (self.path is used instead), so I modified the first line to:

 NSString *fileName = [[fileNamePath lastPathComponent] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]];

It works now, however I'm not sure if I broke something else in the process.

BRRequestError errorCodeWithError not implemented

This method simply returns 0. Here is some more useful code I came up with:

NSDictionary *userInfo = error.userInfo;
NSNumber *code = [userInfo objectForKey:(id)kCFFTPStatusCodeKey];
if (code) {
    return [code intValue];
} else {
    return 0;
}

So far I've only tested this while trying to perform an FTP operation by passing in an invalid password. This results in the expected error 530.

I know the BR implementation of this is the same as the original WR.

Delegate not working properly

I've implemented an FTPHelper class, that does the FTP communication for me using BlackRaccoon, however, all the delegate/required methods are not called.
I'm trying to download a database file from my FTP server, it's not storing though, it did download it, since the data isn't communicated back requestCompleted.
I'm sure that my FTP server is working, and that the data is being transferred because I placed print statements in BRStreamInfo.m. In my understanding, when the stream is complete it should call requestCompleted according to the following snippet

- (void)streamComplete:(BRRequest *)request
{
    NSLog(@"Stream Complete");
    [request.delegate requestCompleted: request];
    NSLog(@"Data tranferred back to FTP helper requestCompleted");
    [request.streamInfo close: request];
}

This is my FTP helper method, FTP request information are stored as constants:


#import "FTPHelper.h"
#import "Utility.h"

@implementation FTPHelper


- (IBAction) downloadFile: (id) sender
{
    downloadData = [NSMutableData dataWithCapacity: 1];

    downloadFile = [[BRRequestDownload alloc] initWithDelegate: self];

    //----- for anonymous login just leave the username and password nil
    downloadFile.path = path1;//Constant
    downloadFile.hostname = hostname1;//Constant
    downloadFile.username = username1;//Constant
    downloadFile.password = password1;//Constant

    NSLog(@"Download Started!!");
    //we start the request
    [downloadFile start];

}

- (void) uploadFile
{
    //----- get the file to upload as an NSData object
    uploadData = [NSData dataWithContentsOfFile: [Utility getDatabasePath]];

    uploadFile = [[BRRequestUpload alloc] initWithDelegate: self];

    //----- for anonymous login just leave the username and password nil
    uploadFile.path = path1;
    uploadFile.hostname = hostname1;
    uploadFile.username = username1;
    uploadFile.password = password1;

    //we start the request
    NSLog(@"Upload Starting.....");
    [uploadFile start];
}

- (IBAction) createDirectory:(id)sender
{
    createDir = [[BRRequestCreateDirectory alloc] initWithDelegate: self];

    //----- for anonymous login just leave the username and password nil
    createDir.path = path1;
    createDir.hostname = hostname1;
    createDir.username = username1;
    createDir.password = password1;

    //we start the request
    [createDir start];
}

- (IBAction) deleteDirectory:(id)sender
{
    deleteDir = [[BRRequestDelete alloc] initWithDelegate: self];

    //----- for anonymous login just leave the username and password nil
    deleteDir.path = path1;
    deleteDir.hostname = hostname1;
    deleteDir.username = username1;
    deleteDir.password = password1;

    //we start the request
    [deleteDir start];
}

- (IBAction) listDirectory:(id)sender
{
    listDir = [[BRRequestListDirectory alloc] initWithDelegate: self];

    //----- for anonymous login just leave the username and password nil
    listDir.path = path1;
    listDir.hostname = hostname1;
    listDir.username = username1;
    listDir.password = password1;

    [listDir start];
}

- (IBAction) deleteFile: (id) sender
{
    deleteFile = [[BRRequestDelete alloc] initWithDelegate: self];

    //----- for anonymous login just leave the username and password nil
    deleteFile.path = path1;
    deleteFile.hostname = hostname1;
    deleteFile.username = username1;
    deleteFile.password = password1;

    //----- we start the request
    [deleteFile start];
}

- (IBAction) cancelAction :(id)sender
{
    if (uploadFile)
    {
        //----- Remove comment if you do not want success delegate called
        //----- upon completion of the cancel
        // uploadFile.cancelDoesNotCallDelegate = TRUE;
        [uploadFile cancelRequest];
    }

    if (downloadFile)
    {
        //----- Remove comment if you do not want success delegate called
        //----- upon completion of the cancel
        // downloadFile.cancelDoesNotCallDelegate = TRUE;
        [downloadFile cancelRequest];
    }
}

- (void) requestDataAvailable: (BRRequestDownload *) request;
{
    [downloadData appendData: request.receivedData];
       NSLog(@"Received: %d", [request.receivedData length]);
}

-(BOOL) shouldOverwriteFileWithRequest: (BRRequest *) request
{
    //----- set this as appropriate if you want the file to be overwritten
    if (request == uploadFile)
    {
        //----- if uploading a file, we set it to YES
        return YES;
    }

    //----- anything else (directories, etc) we set to NO
    return NO;
}

- (NSData *) requestDataToSend: (BRRequestUpload *) request
{
    //----- returns data object or nil when complete
    //----- basically, first time we return the pointer to the NSData.
    //----- and BR will upload the data.
    //----- Second time we return nil which means no more data to send
    NSData *temp = uploadData;   // this is a shallow copy of the pointer

    uploadData = nil;            // next time around, return nil...

    return temp;
}

- (void) percentCompleted: (BRRequest *) request
{
    NSLog(@"%f completed...", request.percentCompleted);
}

-(void) requestCompleted: (BRRequest *) request
{
    NSLog(@"Transger Succesful!!");
    NSLog(@"REQUEST COMPLETED");
    //----- handle Create Directory
    if (request == createDir)
    {
        NSLog(@"%@ completed!", request);

        createDir = nil;
    }

    //----- handle Delete Directory
    if (request == deleteDir)
    {
        NSLog(@"%@ completed!", request);

        deleteDir = nil;
    }

    //----- handle List Directory
    if (request == listDir)
    {
        //----- called after 'request' is completed successfully
        NSLog(@"%@ completed!", request);

        //----- we print each of the file names
        for (NSDictionary *file in listDir.filesInfo)
        {
            NSLog(@"%@", [file objectForKey: (id) kCFFTPResourceName]);
        }


        listDir = nil;
    }

    //----- handle Download File
    if (request == downloadFile)
    {
        //called after 'request' is completed successfully
        NSLog(@"%@ completed!", request);

        NSData *data = downloadFile.receivedData;
        NSLog(@"Size of downloaded file is %d", data.length);

        //----- save the NSData as a file object
//        NSError *error;
        NSLog(@"Database path is %@", [Utility getDatabasePath]);
        NSLog(@"Size of dowbloaded database is %d", data.length);

        NSFileManager *fileManager = [NSFileManager defaultManager];

        [fileManager removeItemAtPath:[Utility getDatabasePath] error:nil];

        [data writeToFile: [Utility getDatabasePath] atomically:YES];
//        [data writeToFile: [Utility getDatabasePath] options: NSDataWritingFileProtectionNone error: &error];

        downloadFile = nil;
    }

    if (request == uploadFile)
    {
        NSLog(@"%@ completed!", request);
        uploadFile = nil;
    }

    if (request == deleteFile)
    {
        NSLog(@"%@ completed!", request);
        deleteFile = nil;
    }   
}

-(void) requestFailed:(BRRequest *) request
{
    NSLog(@"Request Failed");
    if (request == createDir)
    {
        NSLog(@"%@", request.error.message);

        createDir = nil;
    }

    if (request == deleteDir)
    {
        NSLog(@"%@", request.error.message);

        deleteDir = nil;
    }

    if (request == listDir)
    {
        NSLog(@"%@", request.error.message);

        listDir = nil;
    }

    if (request == downloadFile)
    {
        NSLog(@"%@", request.error.message);

        downloadFile = nil;
    }

    if (request == uploadFile)
    {
        NSLog(@"%@", request.error.message);

        uploadFile = nil;
    }

    if (request == deleteFile)
    {
        NSLog(@"%@", request.error.message);

        deleteFile = nil;
    }
}

@end

The header file:


#import <Foundation/Foundation.h>

//---------- include files
#import "BRRequestListDirectory.h"
#import "BRRequestCreateDirectory.h"
#import "BRRequestUpload.h"
#import "BRRequestDownload.h"
#import "BRRequestDelete.h"
#import "BRRequest+_UserData.h"


@interface FTPHelper : NSObject <BRRequestDelegate>
{
    BRRequestCreateDirectory *createDir;
    BRRequestDelete * deleteDir;
    BRRequestListDirectory *listDir;

    BRRequestDownload * downloadFile;
    BRRequestUpload *uploadFile;
    BRRequestDelete *deleteFile;

    NSMutableData *downloadData;
    NSData *uploadData;
}


- (IBAction)downloadFile: (id) sender;

- (void) uploadFile ;

@end

Any help regarding this issue is greatly appreciated.

Handling filename with accent

I'm having an issue when uploading a file with an accent (like é) get stuck, without calling any delegate apparently...
The weird thing is, just before, I create a folder with the same name, and the folder is created normally on the FTP server...

Without the accent no problem whatsoever...

Does anyone know where the problem could be ?

Two warnings present with iOs 6

With the latest version of BlackRaccon using the latest iOs SDK, I always have those 2 warnings:

.../BlackRaccoon/BRStreamInfo.m:185:78: 'dispatch_get_current_queue' is deprecated: first deprecated in iOS 6.0

.../BlackRaccoon/BRStreamInfo.m:251:78: 'dispatch_get_current_queue' is deprecated: first deprecated in iOS 6.0

Everything seems to works well but always having those warning is annoying.

Image uploads halfway

I'm uploading images through FTP, and the image only uploads halfway sometimes. The rest of the picture is just a gray bar. Any help would be appreciated.

Unrecognized selector sent to instance

Hi,

Thank you for the library, it will help me a lot !

I just want to upload a file on a FTP server, so i follow the documentation with examples (only for the upload) but the app crash when i called the start method of BRRequestUpload..

However, when i run the debugger, the app crash only when it fully loaded, don't understand why.

I don't know if i wrote the code correctly but i wrote like the doc.

Thanks for your help !

Unable to complete two download requests in a row.

if I ask for 2 download in a row, only the first request works correctly, the rest just give back 0 bytes or a timeout error occurs. for example the code below will not work, it just times out after the first download.

self.read1 = [[BRRequestDownload alloc] init];
self.read1.delegate = self;
self.read1.path = @"/FTPTest/pic1.png";
self.read1.username = @"username;
self.read1.hostname = @"host.com";
self.read1.password = @"password";

self.read2 = [[BRRequestDownload alloc] init];
self.read2.delegate = self;
self.read2.path = @"/FTPTest/pic2.png";
self.read2.username = @"username;
self.read2.hostname = @"host.com";
self.read2.password = @"password";

[self.read1 start];
[self.read2 start];

-(void)requestCompleted:(BRRequest *)request{

  NSLog(@"size = %i",[[(BRRequestDownload *)request receivedData] length]);

}

Timout issue sometimes

Hi,
I'm using BlackRaccoon for my ftp operations. I have a table view and populated with the the list of files from the ftp server. Whenever I click back button of the table view, I reach the content of that particular directory and store it in my won class. Here is the problem, I often get the timeout issue. means I'm calling the [listDir start]. sometimes it is fetching the list but sometimes it never fetches the list and it also never reaches the requestFailed.

Any idea on this?

repatitive crashes on [readStream open]

In the BRStreamInfo.m i keep getting EXEC_BAD_ACCESS called (somewhat randomly) on the [readStream open] call.

readStream.delegate = request;
[readStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[readStream open];

What I am doing is reading information out of core-data, writing it to a temp file and then firing off various upload calls.

Error after upload

after the upload an error occur when the timeout expires this error happens even when im already in the other screen. This happens in ios6 and ios7.

[__NSDate release]: message sent to deallocated instance 0xecedba0.

screenshot_23_9_13_10_06_pm

Issue with initWithDelegate when uploading

Hello.
I have created an NSobject to call the blackraccoon kit. I have no idea what Im doing wrong but I am sure its something simple..

I receive a 'No known class method for selector: initWithDelegate':

My .h file:
@interface uploadingMechanism : NSObject
{
BRRequestCreateDirectory *createDir;
BRRequestDelete * deleteDir;
BRRequestListDirectory *listDir;

BRRequestDownload *downloadFile;
BRRequestUpload *uploadFile;
BRRequestDelete *deleteFile;

NSMutableData *downloadData;
NSData *uploadData;

}

  • (void) uploadFile;
    @EnD

And from my .m file:

  • (void) uploadFile {

    //before this is just code establishing filePath
    uploadData = [NSData dataWithContentsOfFile: filePath];

    uploadFile = [BRRequestUpload initWithDelegate: self]; //error is here

    //----- for anonymous login just leave the username and password nil
    //uploadFile.sentData = dataToUpload;
    uploadFile.path = pathText;
    uploadFile.hostname = @"xx";
    uploadFile.username = @"xx";
    uploadFile.password = @"xx";
    uploadFile.passiveMode = YES;

    //we start the request
    [uploadFile start];
    }

Any help is really appreciated.
The credentials for the server are correct, the server is fully functioning, I have administrative access to the server if necessary.

Thanks!
Mike

Need 'stop' or 'cancel' methods

There is no obvious API on the request to stop or cancel a large upload/download. Ideally when a request is cancelled, the 'requestComplete' delegate method should NOT be called.

It would also be helpful to have an option when canceling an upload to automatically delete any partially uploaded file from the server.

Errors in the Description please fix

i note that you need to do this to make it work

  • Add CFNetwork framework
  • in the description it says
    createDir = [BRRequestCreateDirectory initWithDelegate: self];

and is
createDir = [[BRRequestCreateDirectory alloc] initWithDelegate: self];

  • you also forgot to close the String with the quotation mark
    createDir.path = @"/home/user/newdirectory/;

Delegate is nil

Hi,

I am implementing uploading images to FTP.
What I need to do is to create a directory for the user first, if it does not exist, and upload his images there.
So I implement BRRequestCreateDirectory and everything goes fine, I am returned with requestCompleted method, but my delegate is nil.
So this line of code: [request.delegate requestCompleted: request] is not executed, because request.delegate is nil. So I cannot go forward to upload the file after I created the directory.

Here is my code:

  • (void)startWithUser:(NSString *)userString imageName:(NSString *)imageName
    {
    self.maximumSize = LONG_MAX;
    bytesIndex = 0;
    bytesRemaining = 0;

    if (![self.delegate respondsToSelector:@selector(requestDataToSend:)])
    {
    [self.streamInfo streamError: self errorCode: kBRFTPClientMissingRequestDataAvailable];
    InfoLog(@"%@", self.error.message);
    return;
    }

    //First, create user's directory, if necessary
    dir = [[BRRequestCreateDirectory alloc] initWithDelegate: self];
    dir.path = [NSString stringWithFormat:@"/%@/", userString];
    dir.hostname = @"ftp.test.com";
    dir.username = @"username";
    dir.password = @"password";
    [dir start];
    }

Any ideas?

Thanks!

File upload only creates a file with 0 byte file size

Hi,

I have the same problem as mentioned in previous issues of partial uploading. When i try to upload the file, i get a requestComplete log, but only a file name is created in the ftp location with file size 0bytes. I need to upload images and video to the ftp location.

Upload gets stalled

I have detected that in some situations, the delegate of BRRequest was set to nil after the initwithdelegate function.
I have fixed in BRRequest.h, changing delegate from weak to strong
Testing in 64bit simulator

Uploading is stuck

Hi Lloyd,

I'm using BlackRaccoon for photos uploading. I'm having a strange problem:
In my development environment uploading was/is working fine, but then I uploaded the binary to iTunes and after approval I check the uploading feature was not working.
I thought that it might be some issue in the binary, then again I tested the app and uploaded the binary. The uploading on the approved binary is still not working.

I check the app log using console:
no images are uploaded.
neither requestCompleted nor requestFailed is fired.

I'm stuck please help.

Crash on "[readStream open]" by repetition of upload

When I upload many times, I get similar error as #48.
I added the code in "BRMainViewController.m".

(void)uploader
{
NSString *applicationDocumentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filepath = [NSString stringWithFormat: @"%@/%@", applicationDocumentsDir, @"image.jpg"];
uploadData = [NSData dataWithContentsOfFile: filepath];
uploadFile = [[BRRequestUpload alloc] initWithDelegate:self];
uploadFile.path = path.text;
uploadFile.hostname = host.text;
uploadFile.username = username.text;
uploadFile.password = password.text;
[uploadFile start];
}

And, added 1 code at "-(void) requestCompleted: (BRRequest *) request".

if (request == uploadFile)
{ NSLog(@"%@ completed!", request);
uploadFile = nil;
-> [self performSelector:@selector(uploader:) withObject:nil afterDelay:1.f];
}

Could you let me know what is caused?

Download Big File Issue

I find a memory issue about downloading big file (≥ 200M). It will crash and have no information without "Received memory warning" in console.

File partially uploading

Hello,

I have noticed with BlackRaccoon that my files are being uploaded, but not the entire file. Images show up as empty with only a small portion of the image uploaded, and even large HTML files are being cut off. I have followed the instructions in the Readme/wiki. How could I fix this?

BRRequestDownload uses more memory than needed

In the stream:handleEvent: method of the BRRequestDownload class, the handling of the NSStreamEventHasBytesAvailable event is using much more memory than is needed. This becomes a real problem when downloading larger files. The code creates a mutable copy of an already mutable data object. Then it appends the new data to the copy. It then replaces the old data with the copy (plus new data). When downloading multi-MB sized files this is A LOT of wasted memory that can easily fail when run on a real iOS device.

Get full datetime (and seconds) of server's files

Me again...

My problem is that I need to get the full last modification date and time of my files, especially the seconds, because it appears that I only receive the date and the hours and minutes.
I am looking in BRStreamInfo, but can't find how to fix it... Do you have any idea ??

Thank you.

For example, here is the logs for one folder :
-----> total 1
-rw-r--r-- 1 Brice staff 6148 Jan 20 11:29 .DS_Store
drwxr-xr-x 2 Brice staff 68 Jan 20 08:42 .dropbox.cache
drwxr-xr-x 14 Brice staff 476 Dec 10 10:02 Exia
drwxr-xr-x 11 Brice staff 374 Oct 31 15:40 IUT
-rw-r--r-- 1 Brice staff 0 Oct 31 15:29 Icon
drwxr-xr-x 29 Brice staff 986 Nov 6 16:51 Mes Docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.