Select to view content in your preferred language

Using the routeTask by giving 2 addresses.

1531
2
05-04-2011 08:13 AM
MiriEshel
Esri Contributor
Hi,

I'm trying to find a route, using the new AGSRouteTask in ver 1.8 by giving two addresses (or current location and destination address. I found the candidates and then try to execute the routeTask.
The problem is that I get EXC_BAD_ACCESS in different places (depends if I run step by step or I run it using breakpoints). I get it in different places. I tried to put @try@catch couple but it doesn't trap this kind of exception.
I'm still fairly new in this business (although I ask a lot of questions) so maybe someone can look at the code and see what can be possible wrong.

Two notes:
1. I call [self solveRouteFromLocation:fromLocationX and:fromLocationY to:toLocationX and:toLocationY]; from both locatorF and locatorT since it runs asynchronously and I'm not sure where it will enter first.
2. Even if I go step by step and comment the line : [self.routeTaskParams setStopsWithFeatures:stops]; it does not get an exception but it does not get into didFailSolveWithError either. If I run it by using breakpoints, it crashes before that.

3. Maybe there is a better way to do it.

Enclosed with the code of the three main functions I use.

Thanks a lot. I admire the brave person who will be able to dive to somebody's else mind.

Thanks again,
Miri
0 Kudos
2 Replies
MiriEshel
Esri Contributor
Hi all,

I think I have found the problem....I released the symbol and that's why it crashed. Now that I looked, I didn't see that the AGSRouteTask sample releases the symbol. I wonder why....

Thanks,
Miri
0 Kudos
NimeshJarecha
Esri Regular Contributor
Glad to know that you got the problem. The Route Task sample uses autorelease instead of release. I would suggest going through Apple doc for memory management to get better understanding.

Regards,
Nimesh
0 Kudos