views:

87

answers:

0

How to integrate BING Map into iPhone Application? I am doing using VirtualEarthKit framework (http://consonancesw.com/blog/?p=64). My code is as below : I am getting error while getting token.

{
 VECommonService *commonService = [[VECommonService alloc] init];
 NSString *token;
 printf("2\n");
 NSError *error=[commonService getToken:&token forUserID:@"abc" password:@"def" ipAddress:@"123"];

 NSString *errMsg= [error description];
 printf("\n%s\n",[errMsg UTF8String]);

  printf("3\n");

 VEGeocodeService *geocodeService = [[VEGeocodeService alloc] init];

 VEGeocodeRequest *geocodeRequest = [[VEGeocodeRequest alloc] init];
  printf("4\n");
 geocodeRequest.query = @"Portland State University";
 geocodeRequest.token = token;

printf("5\n");

 VEServiceResponse *geocodeResponse = [geocodeService geocode:geocodeRequest];

 VEGeocodeResult *geocodeResult = [geocodeResponse.results objectAtIndex:0];


 //NSLog([geocodeResult.location description]);
 //NSLog([geocodeResult.address description]);

 VEImageryService *imageryService = [[VEImageryService alloc] init];

 VEGetMapURIRequest *mapRequest = [[VEGetMapURIRequest alloc] init];

 mapRequest.center = geocodeResult.location;
 mapRequest.token = token;


 VEGetMapURIResponse *mapResponse = [imageryService getMapURI:mapRequest];





 NSURL *url = mapResponse.mapURL;

 //printf("\n\n URL==> %s",[url relativeString]);
 NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
 [webView loadRequest:requestObj];
 [self.view addSubview:webView]; 
}

IS DER ANY OTHER WAY TO INTEGRATE BING MAP IN IPHONE APPLICATION ?