0

I am developing an app that uses ArcGIS iOS SDK.

My requirement is that I want to pass a session token (Received from my backend along with Login response) to each and every service call the SDK makes. As we know the SDK exposed API & usually accepts URL as a parameter. If i supply the URL of the map service, it would fetch the map info like images, etc & loads it on my view. This token is used by my backend team to authorize the user & respond the relevant map information from GIS server.

I know about AGSCredential object that is used to access secure GIS servers. My requirement is not only connecting to a secured GIS server but also get data based on current user. My app has 5 kinds of users who access the same GIS but should not be able to access complete data. To achieve this the Backend team has introduced a proxy layer, where the iOS SDK should talk to it. The proxy layer responds with appropriate data based on token that the client sends along with every request. The SDK requests should have a header with the token.

I wanted to know if this possible and, if yes, how can I accomplish it?

The web developers who use the ARCGIS SDK for .Net managed it by writing a proxy between the SDK and service layer on client. They are suggesting me to also do a similar thing but I doubt if that is possible in iOS.

Perhaps someone came across a similar scenario where you need to proxy the service calls made by a library integrated in an iOS application. I am sure we can add a parameter or header if the service request is written by me, but I want to proxy the calls happening from my SDK (ArcGIS iOS).

1

I don't think that the current ArcGIS Runtime for iOS SDK is designed for consuming proxy directly. But there is one method you can connect to add extra info by using AGSREquest setAdditionalUserAgentInfo: , as you can see this method only take NSString.

Therefore, you need to create a NSURLProtocal class by using pure iOS SDK to make it able to change the headers. add a proxy to NSURLRequest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.