facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.8k stars 3.56k forks source link

FB login dialog default email #43

Closed PSBT closed 14 years ago

PSBT commented 14 years ago

Hi!

I was wondering if there's a way to set a default email in FB login dialog's textfield.

In the past, calling this code

NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSHTTPCookie* testCookie = [NSHTTPCookie cookieWithProperties:
                            [NSDictionary dictionaryWithObjectsAndKeys:
                             [HTTPRequest encodeURLString:email], NSHTTPCookieValue,
                             @"lxe", NSHTTPCookieName,
                             @".facebook.com", NSHTTPCookieDomain,
                             @"/", NSHTTPCookiePath,
                             @"FALSE", NSHTTPCookieDiscard,
                             nil]];
[cookies setCookie:testCookie];

Before this:

FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:_session] autorelease]; dialog.delegate = delegate; [dialog show];

Used to work...Any ideas of how can these work with this new sdk?

Thanks!

yujuan commented 14 years ago

The email should be handled automatically, i.e., if you did not click logout button but just close the app. next time the app start, the email is filled in. you can try this with DemoApp. If you really want to have a default email set in your code you can add the following lines to FBDialog.m at begining of the function - (BOOL)webView:(UIWebView )webView shouldStartLoadWithRequest:(NSURLRequest )request

or http://touch.facebook.com and then use debugger to check which cookie is responsible for set email and do it in similiar way as before.

PSBT commented 14 years ago

Great thanks! That worked! In case anyone needs, the cookie name is "m_user".