I am using facebook sdk 3.0
At facebook i have added users full address as
Address- 1, Infinite loop
city/town - Cupertino, CA
UPDATE
As per the answer I tried to use FBGraphLocation protocol like this
NSDictionary<FBGraphUser> *user
id<FBGraphPlace> objPlace = user.location;
id<FBGraphLocation> objLocation = objPlace.location;
NSLog(@"place.location : %@ location.street : %@",objPlace.location,objLocation.street);
It is giving (null)
for both. also I am getting objLocation object as (null)
In facebook sdk response, I am getting location as only this
location = {
id = 123456789123456;
name = "Cupertino, California";
}
This is not the enough information from where i can get the zipcode of the use.
If facebook does not allow to provide zip code information then any way to get zipcode from only "Cupertino, California"
information ?
I have used this url
http://maps.googleapis.com/maps/api/geocode/json?address=Cupertino,%20California&sensor=true
which give me result as
{
"long_name" = Cupertino;
"short_name" = Cupertino;
types = (
locality,
political
);
},
{
"long_name" = "Santa Clara";
"short_name" = "Santa Clara";
types = (
"administrative_area_level_2",
political
);
},
{
"long_name" = California;
"short_name" = CA;
types = (
"administrative_area_level_1",
political
);
},
{
"long_name" = "United States";
"short_name" = US;
types = (
country,
political
);
}
If I statically put that address into the URL as
http://maps.googleapis.com/maps/api/geocode/json?address=1%20Infinite%20Loop,%20Cupertino,%20CA&sensor=true
Then It gives me Zip code also.
{
"long_name" = 1;
"short_name" = 1;
types = (
"street_number"
);
},
{
"long_name" = "Apple Inc.";
"short_name" = "Apple Inc.";
types = (
establishment
);
},
{
"long_name" = "Infinite Loop";
"short_name" = "Infinite Loop";
types = (
route
);
},
{
"long_name" = Cupertino;
"short_name" = Cupertino;
types = (
locality,
political
);
},
{
"long_name" = "Santa Clara";
"short_name" = "Santa Clara";
types = (
"administrative_area_level_2",
political
);
},
{
"long_name" = California;
"short_name" = CA;
types = (
"administrative_area_level_1",
political
);
},
{
"long_name" = "United States";
"short_name" = US;
types = (
country,
political
);
},
{
"long_name" = 95014;
"short_name" = 95014;
types = (
"postal_code"
);
}
But from the Facebook sdk, I am only getting the City/Town (as stated above), added in contact Information at Facebook.com
How can I do this?
Finally I used google API to get the latitude and longitude from the address I get from the facebook and using those coordinates I find the zip code.
Then I used CLGeocoder class
Hope this help..