• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSMutableURLRequest google my maps help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMutableURLRequest google my maps help


  • Subject: NSMutableURLRequest google my maps help
  • From: Philip Vallone <email@hidden>
  • Date: Sun, 24 Oct 2010 16:26:34 -0400

Hi,

I am trying to upload a xml file to google my maps that follows the following protocol:

http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#uploading_xml

POST http://maps.google.com/maps/feeds/maps/userID/full
Content-type: application/atom+xml
Authorization: GoogleLogin auth="authorization_token"

<entry xmlns="http://www.w3.org/2005/Atom";>
  <title>My Map</title>
  <summary>My Description</summary>
</entry>

I am using the following code:

	if (appDelegate.authGoogleKey != nil) {

		NSString *urlStr = [NSString stringWithFormat:@"//maps.google.com/maps/feeds/maps/%@/full", txtEmail.text];
		NSURL *url = [NSURL URLWithString:urlStr];

		NSMutableURLRequest *uploadRequest = [NSMutableURLRequest requestWithURL:url];

		[uploadRequest setHTTPMethod:@"POST"];

		//set headers
		[uploadRequest addValue:@"Content-Type" forHTTPHeaderField:@"application/atom+xml"];
		[uploadRequest addValue:@"Authorization" forHTTPHeaderField:@"GoogleLogin"];
		[uploadRequest addValue:@"auth" forHTTPHeaderField:appDelegate.authGoogleKey];

		NSString *requestBody = @"<entry xmlns=\"http://www.w3.org/2005/Atom\";><title>My Map</title><summary>My Description</summary></entry>";
		[uploadRequest setHTTPBody:[requestBody dataUsingEncoding:NSASCIIStringEncoding]];

		NSData *returnData = [NSURLConnection sendSynchronousRequest:uploadRequest returningResponse:nil error:nil];
		NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
		NSLog(@"Response: %@ ", returnString);

		[returnString release];

	}else{

		NSLog(@"Not logged in");
	}


I am not getting a response back, which indicates my post method is wrong. Can anyone help me out?

Thanks,



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSMutableURLRequest google my maps help
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: fork/exec vs NSTask
  • Next by Date: [Q] What options to use to display menu bar in a full screen mode
  • Previous by thread: Re: What alhorithm does the launcher follow while processing bundle?
  • Next by thread: Re: NSMutableURLRequest google my maps help
  • Index(es):
    • Date
    • Thread