Connect to a secure map service?

Discussion created by liangchen76 on Nov 29, 2010
Latest reply on Nov 29, 2010 by liangchen76
hey all,

I used AGSCredential in creating a layer for a secure map service. My token service is running with my self-signed certificate. I am sure the username and the password are correct. Here is my code.

AGSCredential *userCredential = [[AGSCredential alloc] initWithUser:userName 
           tokenUrl:[NSURL URLWithString:kAGSTokenServiceURL]];

dynamicLayer = [[[AGSDynamicMapServiceLayer alloc] initWithURL:[NSURL URLWithString:dynamicMapService.serviceURL] credential:userCredential] autorelease];

But I kept getting an error "Unauthorized Access". Unfortunately, I am not sure how to find out some useful information from NSError.

Has anybody tried AGSCredential with a secure service? Please help.