How to license app at standard level through ArcGISOnline

2194
1
03-28-2014 08:19 AM
lynnwang
New Contributor II
hi,
    I am a ArcGISonline subscription user.I want to use the offline editing in my app, so I need the app license at standard level.
    But when I get the license use codes below and create a feature in a local database, the sdk told me that "Licensed for basic use only".
    Is there some thing wrong with my codes??

         NSURL *url = [NSURL URLWithString:@"http://www.arcgis.com"];                
        AGSCredential *credential = [[AGSCredential alloc] initWithUser:@"redMage1" password:@"qulanzhou"];
         credential.authType = AGSAuthenticationTypeToken;
         credential.tokenUrl = [NSURL URLWithString:@"https://www.arcgis.com/sharing/rest/generateToken"];
        self.portal = [[AGSPortal alloc] initWithURL:url credential:credential];

-(void) portalDidLoad:(AGSPortal *)portal{
   
    // Get license info from the portal
    AGSLicenseInfo *licenseInfo = [[AGSLicenseInfo alloc] initWithPortalInfo:portal.portalInfo];
   
    // Set the license
    AGSLicenseResult licenseResult = [[AGSRuntimeEnvironment license] setLicenseInfo:licenseInfo];
}
0 Kudos
1 Reply
DiveshGoyal
Esri Regular Contributor
Check out this sample - https://github.com/Esri/arcgis-runtime-samples-ios/tree/master/LicenseByOrgAccountSample
It shows you how to license the app based on the login, and then save the license to the keychain so that you can still use Standard license for upto 30 days when the app is restarted without network connectivity.
0 Kudos