FBConnect Deprecated Endpoint Error - iphone

I am doing facebook integration part in my project. I downloaded facebook integration sample project from rey wenderlich and then changed appkey and appsecretkey. When I run this app, login validation is working fine and then it shows error.this comes in the same popup after login .
Error: This endpoint has been deprecated. To temporarily reenable it,you may disable the “august_2012” platform migration.I will be permanently disabled on August 1 ,2012
How to fix this error
The functionality I am using is the same of the FbConnect sample code
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
self.usersession =session;
NSLog(#"User with id %lld logged in.", uid);
[self getFacebookName];
}
- (void)getFacebookName {
NSString* fql = [NSString stringWithFormat:
#"select uid,name from user where uid == %lld", self.usersession.uid];
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:#"query"];
[[FBRequest requestWithDelegate:self] call:#"facebook.fql.query" params:params];
self.post=YES;
}

This has a nice documentation with examples

Related

how to get email id and password of facebook login in facebook graph api using doGraphGet method?

I am beginner of iphone developer. I want to login in my app through facebook. I have using facebook graph API. I have passed the doGraphGet method but its not give email id and password. I am using below code..
-(IBAction)getMeButtonPressed:(id)sender {
FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:#"me" withGetVars:nil];
NSLog(#"getMeButtonPressed: %#", fb_graph_response.htmlResponse);
}
It returns the response of
id, firstname, lastname, name, link, username , gender but it is not giving email id and password
so, give any suggestion and source code which is apply in my code..
For that, first you need to ask user permission, and setting different permission for Facebook Api.
Have a look at below permission:
arrFBPermission = [[NSArray arrayWithObjects:
#"email",
#"user_birthday",
#"user_likes",
#"user_location",
#"user_photos",
#"read_stream",
#"status_update",
#"user_about_me",
#"read_friendlists",
#"friends_about_me",
#"friends_birthday",
#"friends_photos",
nil] retain];
Then, as per the latest facebook SDK, you can use the login method as below:
[FBSession openActiveSessionWithReadPermissions:arrFBPermission
allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state,
NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
After successful login, below delegate method will be called:
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error
{
}
And facebook api will not provide you Password.
Hope, you will get success.
Happy Coding!
Cheers!

SSO for iOS - Redirect stopped working today

I have a standard implementation of the Single Sign On for iOS with the AppDelegate listening for the handleOpenURL. Prior to today, this implementation was working fine. I have made no changes to the implementation today, yet the redirect from Facebook in Safari ( on the Simulator ) and the redirect from Facebook app ( on the actual device ) no longer return any data to my app.
I am forwarded to login without issue and login successfully to see that I have already authorized the current app and can now click "Okay", which I do. When the app returns to focus ( after Facebook redirects back to it ), there is no data returned with the redirect.
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
NSLog(#"url recieved: %#", url);
NSLog(#"query string: %#", [url query]);
NSLog(#"host: %#", [url host]);
NSLog(#"url path: %#", [url path]);
// from facebook login
if ( [[url scheme] isEqualToString:FACEBOOK_URL_SCHEME] ) {
return [SESSION.facebook handleOpenURL:url];
}
return YES;
}
The values for all of the logs are empty - the app logs nothing. The request to authorize is below:
NSArray *permissions = [[NSArray alloc] initWithObjects:
#"publish_actions",
#"email",
#"user_checkins",
#"user_likes",
#"user_photos",
#"offline_access",
#"publish_stream",
#"read_friendlists",
nil];
[SESSION.facebook authorize:permissions];
Again, this very code worked perfectly yesterday and for the last 3 weeks. Today it simply stopped working. Any help is appreciated. Please let me know if more code is needed to evaluate the issue.
Thanks in advance!
Jane
Now - for no explainable reason it is working again. I did check Facebook SDK Status prior to posting here and everything was green. I guess I'll chalk this one up to a blip in the internets.

getting blank FBPermission Dialog in iphone app

I successfully integrate the face-book API and able to get all user profile but the problem is the value i am getting without permission dialog. In place of permission dialog i am getting blank white dialog without any content or any buttons.I am using FBConnect.
I Done with this code i stuck from last many days because i am not able to find the reason also i tried google to get solution but not get success.
My code is here to display dialog.
`-(void)askPermission:(id)target{
FBPermissionDialog* dialog = [[[FBPermissionDialog alloc] init]
autorelease];
//dialog.permission = [NSString stringWithString: #"user_birthday,user_interests"];
dialog.delegate = self;
dialog.permission = #"user_interests,user_birthday";
[dialog show];
}`
in FBPermissionDialog.m
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
// if (_permission = [NSString stringWithFormat:#"user_interests"]);
// {
// NSURL* url = request.URL;
// if ([url.scheme isEqualToString:#"fbconnect"]) {
// if ([url.resourceSpecifier isEqualToString:#"success"]) {
// [self redirectToLogin];
// return NO;
// }
//}
return [super webView:webView shouldStartLoadWithRequest:request navigationType:navigationType];
}
-(void)dialogDidSucceed:(FBDialog*)dialog {
NSString* fql = [NSString stringWithFormat:
#"select name, first_name, last_name, hometown_location, sex, pic_square, current_location, interests, birthday_date , activities, tv, movies, music, books from user where uid == %lld", _session.uid];
NSLog(#"%#",fql);
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:#"query"];
NSLog(#"%#",params);
[[FBRequest requestWithDelegate:self] call:#"facebook.fql.query" params:params];
}
Please help me i don't know why i didn't get the permission Dialog and getting blank screen .Any help will be appreciated.
Thank You
meaning you are not getting the login credential dialogue. Is there any dialog appearing BUT its blank? If yes please make sure you have the latest Facebook for IOS sdk downloaded please :) Link : https://github.com/facebook/facebook-ios-sdk

Calling Facebook API method from iPhone SDK

I got Facebook Connect working and all and it's loading up the user's friends list with perfection. So now I have the logged in user's UID and the friend's UID. How would I go about calling their users.getInfo method from the SDK? The example below is what they give me to set a status, but I don't know how I can transform it to work with what I need. Especially the NSDictionary part. Please help!
Example Code -
NSString *statusString = exampleTextField.text;
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
statusString, #"status",
#"true", #"status_includes_verb",
nil];
[[FBRequest requestWithDelegate:self] call:#"facebook.Users.setStatus" params:params];
Thanks for any help!
According to the documentation at http://github.com/facebook/facebook-iphone-sdk you have to use the old API calls and the Facebook Query Language (fql) to pull information via the SDK. So you'd have to identify what information you want (or pull in a bunch and separate).
Here's the example they give to pull a user's name.
- (void)getUserName {
NSString* fql = #"select name from user where uid == 1234";
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:#"query"];
[[FBRequest requestWithDelegate:self] call:#"facebook.fql.query" params:params];
}
- (void)request:(FBRequest*)request didLoad:(id)result {
NSArray* users = result;
NSDictionary* user = [users objectAtIndex:0];
NSString* name = [user objectForKey:#"name"];
NSLog(#"Query returned %#", name);
}
getUserName shows you the data pull which you could adapt to create new routines--but the request:didLoad: function would need some internal switching.

To display permission page in facebook of iphone

I am new to iphone development, i want to display the permission page after logging facebook.
buttonIndex is the index of my actionsheets.
if(buttonIndex == 1)
{
session = [FBSession sessionForApplication:#"My App key" secret:#"My Key" delegate:self];
FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:session] autorelease];
[dialog show];
}
by using those code successfully loggin to facebook, but i want to permission page to display,
so i can use,
- (void)session:(FBSession*)session didLogin:(FBUID)uid
{
NSLog(#"User with id %lld logged in.", uid);
FBPermissionDialog* dialog1 = [[[FBPermissionDialog alloc] init] autorelease];
dialog1.delegate = self;
dialog1.permission = #"uid";
[dialog1 show];
}
But its not working. Where can i put that code.
And I want to share my content after the permission allowed.
If i logout the facebook, it goes to the browser but i want to return my application after logout,
Please help me out, guide me plz.
I would change this dialog1.permission = #"uid"; to something like this
dialog1.permission = #"publish_stream";. Because you want to publish your content to the users stream, right?
- (void)session:(FBSession*)session didLogin:(FBUID)uid
After loggin in I would first check if you might already have the permission to publish to the user's stream, by creating a FBRequest
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: #"publish_stream", #"ext_perm", nil];
[[FBRequest requestWithDelegate:self] call:#"facebook.users.hasAppPermission" params:params];
The result you can evaluate here
- (void)request:(FBRequest*)request didLoad:(id)result
e.g. like this
if ([request.method isEqualToString:#"facebook.users.hasAppPermission"])
{
NSString *success = result;
if ([success isEqualToString:#"1"])
{
NSLog(#"User has app permission");
// publish content now
...
}
else
{ // else ask for permission, opening permission dialog
...
}
I highly recommend this guy's tutorial, Brandon Treb, on integrating Facebook. He does a very thorough presentation and takes you line-by-line, so if it does not work, its a typo on your part. His tutorial got me up and running in less than two hours.
http://brandontreb.com/