Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-23-2012, 04:49 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2010
Posts: 82
Guthook is on a distinguished road
Default Asynchronous ASIHTTPRequest crashing

I've been trying to get downloads with ASIHTTPRequest working, and so far I've made some progress, but selectors are giving me trouble.

I'm trying to download lists of files from several folders in a S3 bucket. When using synchronous requests, everything works fine, but it stops the app for a few seconds, so I want to use async requests to make the request work in the background. Here's the method that's crashing:

Code:
for (int i = 1; i <= numberOfFolders; i++) {
     ASIS3BucketRequest *listRequest = [ASIS3BucketRequest requestWithBucket:bucket];
[listRequest setAccessKey:accessKey];
[listRequest setSecretAccessKey:secretAccessKey];


    NSString *baseDirectory = @"mapTiles/batches";

    NSString *pathToBatch = [NSString stringWithFormat:@"%@/Folder%i", baseDirectory, i];
[listRequest setPrefix:pathToBatch];
        [listRequest setDelegate:self];
[listRequest setDidFinishSelector:@selector(finishedDownloadingTileList:)];
[listRequest setDidFailSelector:@selector(failedDownloadingTileList:)];
        [listRequest startAsynchronous];
}
The two selectors right now do nothing but write "success" or "failure" in NSLog, but the app doesn't make it that far-- just crashes when I call startAsynchronous.

Any pointers for me? The ASI how-to's website got me to this point, but I'm not sure how to get past this. Thanks for any help!
Guthook is offline   Reply With Quote
Old 01-23-2012, 06:41 PM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

What is the crash message in the console?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-24-2012, 06:11 AM   #3 (permalink)
Registered Member
 
Join Date: Dec 2010
Posts: 82
Guthook is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
What is the crash message in the console?
Dang... I knew I should have included that. I'm away from my computer today, so I'll get that as soon as I get home tonight. I suspect the issue has something to do with setting up the [self] class as a ASIHTTPRequestDelegate or using selectors, since those are two things I haven't fully grasped yet.
Guthook is offline   Reply With Quote
Old 01-24-2012, 06:53 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2010
Posts: 82
Guthook is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
What is the crash message in the console?
Okay. Got back to my computer and tried it out, and the console says:
"sharedlibrary apply-load-rules all
(gdb)"

And the debug navigator says "Thread 1: Program received signal: EXC_BAD_ACCESS".

Any clues there?
Guthook is offline   Reply With Quote
Old 01-24-2012, 09:40 PM   #5 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Not really. Post the entire method.

Also, depending on how many downloads you are firing off, you may want to use a download queue.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-25-2012, 06:35 AM   #6 (permalink)
Registered Member
 
Join Date: Dec 2010
Posts: 82
Guthook is on a distinguished road
Default

Thanks for looking at this Brian. I should indeed use a queue. I was having trouble figuring out how to get the examples on ASI's website to work, since the examples have a few property variables that I didn't recognize.

Problem solved, though! The method for downloading those lists of files was in its own class, which the mainViewController would create an instance of in order to handle these big downloads. The mainViewController was releasing the instance of the downloader class before the Async (or queue) was done, which seems to be the cause of the crash. I guess I need to declare and release the downloader class somewhere other than where I've been doing that.
Guthook is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 383
11 members and 372 guests
7twenty7, Atatator, condor304, FrankWeller, glenn_sayers, iphonedevshani, MAMN84, mraalex, QuantumDoja, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,122
Posts: 402,907
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:48 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0