Having trouble using World Route in iOS app

1420
4
Jump to solution
09-11-2016 04:14 PM
ShayneBrady
New Contributor

Hi there, Im new to using arcgis and I am trying to add routing capabilities to my iOS app. I downloaded the Routing Sample app from github and it works great straight out of the box. We need the routing to work in Australia so I thought I would use World Route. I created a developer account and have generated a short lived token so I can use World Route.

Any way, here what is happening:

I am declaring the route task url

#define kRouteTaskUrl @"http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer"

 and adding it to the map

NSURL *routeTaskUrl = [NSURL URLWithString:kRouteTaskUrl];

self.routeTask = [AGSRouteTask routeTaskWithURL:routeTaskUrl credential:cred];

and here is the error it is returning

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 9223372036854775807 beyond bounds [0 .. 16]'

*** First throw call stack:

I cant work out which array it is talking about though.

It's strange because if I use the original route url:

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route

Than it works fine, I just cant route anywhere in Australia.

Anyway I hope you can help me out.

Regards

0 Kudos
1 Solution

Accepted Solutions
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Shayne,

Here are some tips that I would recommend to you to troubleshoot the issue:

1. I would highly recommend to check our Runtime iOS SDK documentation for Route task: Route task—ArcGIS Runtime SDK for iOS | ArcGIS for Developers. This documentation will provide you some basic idea about how it works in iOS SDK;

2. Since you are using our World Route service, you need to make sure the input parameters that you passed from your app is matching the schema from our service. Please follow this documentation to check if your input params is correct:

ArcGIS REST API - Route service with synchronous execution 

3. Another good debugging skill for you to track what kind of requests that your iOS device or simulator that sending to server is using proxy tool either Fiddler or Charles.

For fiddler setup for iphone: http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureForiOS 

For Charles setup for iOS: Using Charles from an iPhone • Charles Web Debugging Proxy 

Once you setup the proxy tool and you can get the requests and see if the right parameters pass to server and then check what kind of response you get. I would recommend to directly test on REST first to make sure that you can get the right response, then you can move to iOS SDK side

Last but not lease, this URL:

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route 

I believe it only provide the USA Route, and that's why you can't route in Australia

Hope this can help.

View solution in original post

0 Kudos
4 Replies
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Shayne,

Here are some tips that I would recommend to you to troubleshoot the issue:

1. I would highly recommend to check our Runtime iOS SDK documentation for Route task: Route task—ArcGIS Runtime SDK for iOS | ArcGIS for Developers. This documentation will provide you some basic idea about how it works in iOS SDK;

2. Since you are using our World Route service, you need to make sure the input parameters that you passed from your app is matching the schema from our service. Please follow this documentation to check if your input params is correct:

ArcGIS REST API - Route service with synchronous execution 

3. Another good debugging skill for you to track what kind of requests that your iOS device or simulator that sending to server is using proxy tool either Fiddler or Charles.

For fiddler setup for iphone: http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureForiOS 

For Charles setup for iOS: Using Charles from an iPhone • Charles Web Debugging Proxy 

Once you setup the proxy tool and you can get the requests and see if the right parameters pass to server and then check what kind of response you get. I would recommend to directly test on REST first to make sure that you can get the right response, then you can move to iOS SDK side

Last but not lease, this URL:

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route 

I believe it only provide the USA Route, and that's why you can't route in Australia

Hope this can help.

0 Kudos
ShayneBrady
New Contributor

Thanks Yue,

It was just an incorrect url, simple mistake on my part

0 Kudos
ShayneBrady
New Contributor
0 Kudos
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

No problem! Glad you figure it out. 

Please feel free to mark this question been resolved.


Best Regards,

0 Kudos