Select to view content in your preferred language

Error getting default parameters: Cannot call this method in this context

1666
13
02-24-2019 10:53 AM
SamerAbraham
Emerging Contributor

Hello

I'm calling the route service from iOS as follows:

let routeTask = AGSRouteTask(url: URL(string: "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World")!)

routeTask.defaultRouteParameters { [weak self] (defaultParameters, error) in guard error == nil else {

print("Error getting default parameters: \(error!.localizedDescription)")

return

}

I keep hitting the error condition with Error Code 15 stating "Error getting default parameters: Cannot call this method in this context".

Anyone have any leads on what might cause this?

Thanks

0 Kudos
13 Replies
SamerAbraham
Emerging Contributor

Not exactly.  I was something like this Sample Code—ArcGIS Runtime SDK for iOS | ArcGIS for Developers  not github.  Steps are pretty similar if not exactly the same however I started from an existing project not the sample code.

0 Kudos
Nicholas-Furness
Esri Regular Contributor

It looks like you took the authentication code from the OAuth 2 DevLab. It's hard to know where things went wrong, but I would like to dig a little deeper in case we can improve things.

I know you moved on from the point where things weren't working, but if you are able to DM me an Xcode project that shows this behavior, I'd be happy to take a look.

Let me know.

0 Kudos
SamerAbraham
Emerging Contributor

For some reason I don't see the post but I saw an email where someone asked me if the routeTask was a class level or method level variable.  It is class level per the example I saw.

0 Kudos
Nicholas-Furness
Esri Regular Contributor

I think that was my original reply above, which I edited to be more explicit/correct.

0 Kudos