Note that there are some explanatory texts on larger screens.

plurals
  1. POEXC_BAD_ACCESS / SIGSEGV when uploading with FTP library on iOS (CFWriteStreamOpen)
    primarykey
    data
    text
    <p>I am using <a href="https://github.com/erica/iphone-3.0-cookbook-/tree/master/C13-Networking/15-FTP%20Helper" rel="nofollow noreferrer">FTPHelper</a> to perform basic download/upload FTP functions. I have been getting frequent crashes when using it to upload to my destination. The crashes don't seem to ever occur on the first upload but become more and more likely as I make subesequent calls. Xcode spits out <strong>EXC_BAD_ACCESS(code=1, address=0x30)</strong> at line 517 of the helper class::</p> <pre><code>success = CFWriteStreamOpen(writeStream); </code></pre> <p>I've enabled exception breakpoints and zombies but I'm not seeing anything I can make sense of. Here's a snap of what my stack trace looks like at each crash:</p> <p><img src="https://i.stack.imgur.com/oxiEb.png" alt="enter image description here"></p> <p>I have been able to recreate this same stack trace with several other FTP libraries (<a href="https://github.com/lloydsargent/BlackRaccoon" rel="nofollow noreferrer">BlackRaccon</a> and <a href="https://github.com/nkreipke/FTPManager" rel="nofollow noreferrer">FTPManager</a>). </p> <p>The file being uploaded is a simple one generated from the user's interaction with the UI, meaning it's dynamic based on what the user selects on screen. Here is the code that generates, locally saves, and uploads the file:</p> <pre><code>//Prepare to write a new file to the device and then upload it NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *putContent = [NSString stringWithFormat:@"V%d\n", (int)(funnySlider.value * -1)]; NSString *writepath = [documentsDirectory stringByAppendingPathComponent:@"foo.dat"]; //if the path exists if([[NSFileManager defaultManager] fileExistsAtPath:writepath]){ //Upload the newly created file [putContent writeToFile:writepath atomically:NO encoding:NSASCIIStringEncoding error:nil]; [FTPHelper upload:@"foo.dat"]; } </code></pre> <p>Some odd things I wanted to highlight as well... Filling foo.dat with lots of mumbo jumbo content to increase its file size makes the app much more stable. It's almost reliable at 100KB+. I also have no crashes when using an iPod Touch 4th Generation (okay, I had ONE but it was after dozens and dozens of test sessions). iPhones and iPads do however. Any ideas on how to fix this or why it might be happening? Should I abandon this mode of uploading?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload