#import <UIKit/UIKit.h> #import "ArcGis.h" @interface ViewController : UIViewController @property (retain, nonatomic) IBOutlet AGSMapView *mapView; @end
#import "ViewController.h" @implementation ViewController synthesize mapView; ..... - (void) openIntoMapView: (AGSMapView*) mapView { AGSCredential* credential = [[[AGSCredential alloc] initWithUser:@<my_user_name> password:@<My_passdword>] autorelease]; credential.authType = AGSAuthenticationTypeToken; AGSWebMap* webmap = [[AGSWebMap alloc] initWithItemId:@e20f2f98b35c4963a5e124bf43c1d74a credential:credential]; }
//- (void) openIntoMapView: (AGSMapView*) mapView { - (void)viewDidLoad { self.webmap = [[AGSWebMap alloc] initWithItemId:@d802f08316e84c6592ef681c50178f17 credential:nil]; self.webmap.delegate = self; }
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 8 20:32:45 UTC 2011) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin". sharedlibrary apply-load-rules all Attaching to process 505.
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 8 20:32:45 UTC 2011) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin". sharedlibrary apply-load-rules all Attaching to process 16588. Couldn't register c.webMap with the bootstrap server. Error: unknown error code. This generally means that another instance of this process was already running or is hung in the debugger.Current language: auto; currently objective-c (gdb)
#import <UIKit/UIKit.h> #import "ArcGis.h" @interface ViewController : UIViewController <AGSWebMapDelegate> @property (retain, nonatomic) IBOutlet AGSMapView *mapView; @property (retain, nonatomic) AGSWebMap *webmap; @end
#import "ViewController.h" @implementation ViewController synthesize mapView; @synthesize webmap; #pragma mark - - (void) openIntoMapView: (AGSMapView*) mapView { self.webmap = [[AGSWebMap alloc] initWithItemId:@d802f08316e84c6592ef681c50178f17 credential:nil]; self.webmap.delegate = self; } - (void)webMapDidLoad:(AGSWebMap *)webmap { NSLog(@delegate webMapDidLoad); //open webmap in mapview [self.webmap openIntoMapView:self.mapView]; } -(void)didOpenWebMap:(AGSWebMap*)webmap intoMapView:(AGSMapView*)mapView { NSLog(@delegate didOpenWebMap); } - (void)dealloc { [mapView release]; [super dealloc]; } - (void)viewDidUnload { [self setMapView:nil]; [super viewDidUnload]; } @end
#import <UIKit/UIKit.h> #import "ArcGis.h" @interface <Classname> : UIViewController <AGSWebMapDelegate> @interface ViewController : UIViewController @property (retain, nonatomic) IBOutlet AGSMapView *mapView; @property (retain, nonatomic) AGSWebmap *webmap; @end
- (void)viewDidLoad { AGSCredential* credential = [[[AGSCredential alloc] initWithUser:@<my_user_name> password:@<My_passdword>] autorelease]; credential.authType = AGSAuthenticationTypeToken; self.webmap = [[AGSWebMap alloc] initWithItemId:@e20f2f98b35c4963a5e124bf43c1d74a credential:credential]; self.webmap.delegate = self } #pragma mark AGSWebMapDelegate - (void)webMapDidLoad:(AGSWebMap *)webMap { NSLog(@delegate webMapDidLoad); //open webmap in mapview [self.webMap openIntoMapView:self.mapView]; } -(void)didOpenWebMap:(AGSWebMap*)webMap intoMapView:(AGSMapView*)mapView { NSLog(@delegate didOpenWebMap); }
Just add a code line... AGSCredential* credential = [[[AGSCredential alloc] initWithUser:@<my_user_name> password:@<My_passdword>] autorelease]; credential.authType = AGSAuthenticationTypeToken; AGSWebMap* webmap = [[AGSWebMap alloc] initWithItemId:@e20f2f98b35c4963a5e124bf43c1d74a credential:credential]; [webmap openIntoMapView:self.mapView]; //addedRegards,Nimesh
AGSCredential* credential = [[[AGSCredential alloc] initWithUser:@<my_user_name> password:@<My_passdword>] autorelease]; credential.authType = AGSAuthenticationTypeToken; AGSWebMap* webmap = [[AGSWebMap alloc] initWithItemId:@e20f2f98b35c4963a5e124bf43c1d74a credential:credential]; [webmap openIntoMapView:self.mapView]; //added
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.