I am fetching a facebook token from my server (where it was stored from a previous login on another device). I am using that to open a session and then I am making a relatively simple call with
[FBWebDialogs presentRequestsDialogModallyWithSession:[FBSession activeSession]
message:#"Message"
title:#"Title"
parameters:params
handler:^(FBWebDialogResult result,
NSURL *resultURL, NSError *error) {}}];
The web window that pops up has a message saying "An Error occured. Please try again later.". I click OK and I trigger the callback (which I omitted above). When I trace the resultURL I get
fbconnect://success?error_code=110&error_msg=Missing+user+cookie+%28to+validate+session+user%29
I can use the session to post on my wall just fine. What am I missing?
I found that the token retuned by Facebook contains additional metadata such as the c_user cookie which is used by all web views subsequently. When setting up a remote caching system you must store expiry date and refresh date on the remote server and return them for use in the TokenData object. If this is not done correctly them the correct metadata is not set.
Make sure you have "publish_actions" permission on your active Facebook session.
bool hasPublishPermission = NO;
for( NSString* permission in [FBSession.activeSession permissions] )
{
if( [permission isEqualToString:#"publish_actions"] )
{
hasPublishPermission = YES;
break;
}
}
if( !hasPublishPermission )
{
[FBSession openActiveSessionWithPublishPermissions:#[#"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
if( status==FBSessionStateOpen )
{
//Present dialog
}
}];
}
else
{
//Present dialog
}
Also, make sure you have added your "FacebookAppID" to your project's plist. (See the tab, "Configure a new Xcode Project", at https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/ ) This may cause the error you are describing.
Hope this helps
I have integrated Embedded webview in my app with Facebook sdk 3.5.3
I hope my code will give some idea to you...
-(IBAction)fblogin:(id)sender{
NSArray * arr=[NSArray arrayWithObjects:#"publish_actions",#"email",#"basic_info",#"user_location",#"user_birthday",#"user_likes", nil];
Interest_Status=[NSString stringWithFormat:#"%#",txt_interest.text];
[FBSession setActiveSession:session];
if (FBSession.activeSession.isOpen) {
if ([btn_Login.titleLabel.text isEqualToString:#"Logout"]) {
[btn_Login setTitle:#"Login" forState:UIControlStateNormal];
[btn_Login setImage:[UIImage imageNamed:#"FBLogin.png"] forState:UIControlStateNormal];
FBSessionTokenCachingStrategy *tokenCachingStrategy = [[FBSessionTokenCachingStrategy alloc]
initWithUserDefaultTokenInformationKeyName:nil];
tokenCachingStrategy=nil;
FBSession *seession=[FBSession activeSession];
[seession closeAndClearTokenInformation];
[session close];
[FBSession setActiveSession:nil];
session=nil;
session=[[FBSession alloc]initWithPermissions:arr];
self.ProfileLale.hidden=YES;
}
/*else if ([btn_Login.titleLabel.text isEqualToString:#"Login"]) {
[self updateForSessionChangeForSlot:1];
}*/
}else{
[session openWithBehavior:FBSessionLoginBehaviorForcingWebView
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// this handler is called back whether the login succeeds or fails; in the
// success case it will also be called back upon each state transition between
// session-open and session-close
if (error)
{
NSLog(#"error=%# \n\n description=%# \n\n,",error,error.description);
[self switchToNoActiveUser];
}else{
[self updateForSessionChangeForSlot:1];
}
}];
}
}
- (void)updateForSessionChangeForSlot:(int)slot {
if (session.isOpen) {
// fetch profile info such as name, id, etc. for the open session
// Fetch user data
FBRequest *me = [[FBRequest alloc] initWithSession:session
graphPath:#"me"];
[me startWithCompletionHandler:^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *error) {
// because we have a cached copy of the connection, we can check
// to see if this is the connection we care about; a prematurely
// cancelled connection will short-circuit here
// if (me != self.pendingRequest) {
// return;
// }
NSLog(#"user=%#",user);
// self.pendingRequest = nil;
// self.pendingLoginForSlot = -1;
// we interpret an error in the initial fetch as a reason to
// fail the user switch, and leave the application without an
// active user (similar to initial state)
if (error) {
NSLog(#"error=%#",error);
NSLog(#"Couldn't switch user: %#", error.localizedDescription);
[self switchToNoActiveUser];
return;
}else{
NSLog(#"user=%#",user);
[btn_Login setTitle:#"Logout" forState:UIControlStateNormal];
[btn_Login setImage:[UIImage imageNamed:#"FBLogout.png"] forState:UIControlStateNormal];
}
}];
} else {
// in the closed case, we check to see if we picked up a cached token that we
// expect to be valid and ready for use; if so then we open the session on the spot
if (session.state == FBSessionStateCreatedTokenLoaded) {
// even though we had a cached token, we need to login to make the session usable
[session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
[self updateForSessionChangeForSlot:slot];
}];
}
}
}
- (void)switchToNoActiveUser {
/*UIAlertView *alter=[[UIAlertView alloc]initWithTitle:#"Message" message:#"No Internet connecton" delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles:nil, nil];
[alter show];
*/
NSArray * arr=[NSArray arrayWithObjects:#"publish_actions",#"email",#"basic_info",#"user_location",#"user_birthday",#"user_likes", nil];
session = nil;
session=[[FBSession alloc]initWithPermissions:arr];
[btn_Login setTitle:#"Login" forState:UIControlStateNormal];
self.ProfileLale.hidden=YES;
[btn_Login setImage:[UIImage imageNamed:#"FBLogin.png"] forState:UIControlStateNormal];
}
Related
Using SDK 3.22.0.
if (FBSession.activeSession.isOpen) {
[FBSession.activeSession
requestNewPublishPermissions:#[#"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
NSLog(#"error = %#", error);
NSLog(#"session open = %d", session.isOpen);
NSLog(#"session.permissions = %#", session.permissions);
NSLog(#"session.accessTokenData.declinedPermissions = %#", session.accessTokenData.declinedPermissions);
}];
}
else {
[FBSession
openActiveSessionWithPublishPermissions:#[#"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
NSLog(#"error = %#", error);
NSLog(#"session open = %d", session.isOpen);
NSLog(#"status = %lu", status);
NSLog(#"session.permissions = %#", session.permissions);
NSLog(#"session.accessTokenData.declinedPermissions = %#", session.accessTokenData.declinedPermissions);
}];
}
I'm testing with a user that doesn't have yet publish permissions and never declined it either. On FB Apps Settings on this account, the App Visibility is set to "Friends" and publishing permissions are not even on the settings list as they are for other users/apps.
In both cases of the code, the FB app opens and returns to my app immediately, without asking permissions. Response of declinedPermissions is an array with publish_actions.
My expectation is that FB app will ask the user to approve publishing.
I got reports from multiple users that experienced the same issue - not being able to add publish permissions, but some are able to get the permission.
One thing to add is that I had the same issue before submitting the app for FB approval with users outside of the test group, but when app got approved it started working for those users. Now it seems like the problem persists even when the app is approved, just for random users.
Am I doing anything wrong with the way I'm asking for permissions?
Looks like this worked:
- (BOOL)hasWritePermissions {
if (!FBSession.activeSession.isOpen) return NO;
return [FBSession.activeSession.permissions indexOfObject:#[#"publish_actions"]] != NSNotFound;
}
- (void)requestWritePermissions:(void(^)(BOOL status, NSError *error))callback {
if (self.hasWritePermissions) {
callback(YES, nil);
return;
}
if (FBSession.activeSession.isOpen) {
[FBSession.activeSession
requestNewPublishPermissions:#[#"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
NSLog(#"error = %#", error);
NSLog(#"session open = %d", session.isOpen);
NSLog(#"session.permissions = %#", session.permissions);
NSLog(#"session.accessTokenData.declinedPermissions = %#", session.accessTokenData.declinedPermissions);
if (self.hasWritePermissions) {
callback(YES, nil);
}
else {
callback(NO, error);
}
}];
}
else {
[FBSession
openActiveSessionWithPublishPermissions:#[#"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
NSLog(#"error = %#", error);
NSLog(#"session open = %d", session.isOpen);
NSLog(#"status = %u", status);
NSLog(#"session.permissions = %#", session.permissions);
NSLog(#"session.accessTokenData.declinedPermissions = %#", session.accessTokenData.declinedPermissions);
[self requestWritePermissions:callback]; // this time, with an open session
}];
}
}
If there's no session, I run openActiveSessionWithPublishPermissions and then run again requestNewPublishPermissions.
Issue is that openActiveSessionWithPublishPermissions was firing the callback without even going to Facebook app for more permissions (looks like FB bug, will report), but this approach seems to solve it.
Another issue I found is that session.permissions are not always reflecting the permissions on Facebook. The only way I found to ensure I have the latest permissions is to issue an API request:
[FBRequestConnection startWithGraphPath:#"/me/permissions" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
and check the result.data array for granted/declined permissions.
I had a similar issue with this method. I ended up opening the session with a full set of permissions (read & write ) and it solved my problem.
-(void)requestPublishPermissionsWithCompletion:(FBHandlerComp)completion{
if (self.session.isOpen && [self.session.permissions containsObject:#"publish_actions"]){
//we have an open session and all neceassarry pemissions
completion(true,nil);
}else{
//something in missing, to account to all diffrent scenarios (missing persmission, expired tokens, changes in user sessting etc..), we reinisilise the session and request permissions
//for publish permissions we need to ask for the whole set( read& publish)
NSMutableArray *permissions = [NSMutableArray arrayWithArray:self.writePersmissions];
[permissions addObjectsFromArray:self.readPersmissions];
self.session = [[FBSession activeSession]initWithAppID:nil permissions:permissions defaultAudience:FBSessionDefaultAudienceFriends urlSchemeSuffix:nil tokenCacheStrategy:nil];
[self openFacebookSessionWithCompleteion:^(BOOL result, NSError *error) {
if (result) {
completion(true,nil);
}else{
if (LOGGING_IS_ON) DebugLog(#"could not get publish permissions- could not open session %#",error);
completion(false,nil);
}
}];
}
}
I am having a problem with requestNewPublishPermissions (I'm using SDK version 3.17). The Facebook docs say to log in with just read permission, and then later ask for write permission, so that's what I'm trying to do. I can get the user to log in just fine with code like this:
[FBSession openActiveSessionWithReadPermissions:#[#"public_profile"]
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState state, NSError *error)
{
// Handler for session state changes
// This method will be called EACH time the session state changes,
// also for intermediate states and NOT just when the session open
[self sessionStateChanged:session state:state error:error];
}];
Then when I want to post to the timeline, I ask to expand the permissions using the code below. The app kicks out to Safari with a Facebook web page. But instead of asking for write permission, that web page just says that the app was already given permission. And then when I hit okay, and control returns to the app, I do NOT have publish permission. See "this is where it ends up!" below.
I have tried going to facebook.com and deleting the permissions already given under "Apps". That didn't make any difference. I've also tried doing a publish anyway, but that gives me an error that says I don't have the correct permissions.
Any ideas?
- (void) requestPublishPermission:(void (^)(void)) action
{
// Request publish_actions
[FBSession.activeSession requestNewPublishPermissions:[NSArray arrayWithObject:#"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error)
{
if (!error)
{
if ( [FBSession.activeSession.permissions indexOfObject:#"publish_actions"] == NSNotFound )
{
// this is where it ends up!
}
else
{
// Permission granted, publish the story
action();
}
}
else
{
// permission denied, alert user
}
}];
}
You need to add the user you are logging in as as a Developer/Tester. Or you need to submit your app to Facebook for review.
I have the same issue and it is happening only when the user is not using the FB App and everything is happening via the Web. This is what I did to resolve the problem:
typedef void(^facebookPostCompBlock)(FBSession *session, NSError* err, BOOL publishActionPermissions);
- (void) obtainPostPermissionsWithComplition:(facebookPostCompBlock) comp {
if ([[FBSession activeSession] isOpen]) {
if ([[[FBSession activeSession] permissions]indexOfObject:#"publish_actions"] == NSNotFound) {
[FBSession.activeSession requestNewPublishPermissions:#[#"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error)
{
BOOL gotPublishActionPermissions = TRUE;
if ([[[FBSession activeSession] permissions]indexOfObject:#"publish_actions"] == NSNotFound) {
gotPublishActionPermissions = FALSE;
}
if (comp) {
comp(session,error,gotPublishActionPermissions);
}
}];
} else {
if (comp) {
comp([FBSession activeSession],nil,TRUE);
}
}
} else {
BOOL openedSynchronously = [FBSession openActiveSessionWithPublishPermissions:#[#"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState status, NSError *error)
{
if (!error && status == FBSessionStateOpen) {
[self obtainPostPermissionsWithComplition:comp];
} else {
BOOL gotPublishActionPermissions = TRUE;
if ([[session permissions]indexOfObject:#"publish_actions"] == NSNotFound) {
gotPublishActionPermissions = FALSE;
BLog(#"+ NOT FOUND +");
} else {
if (comp) {
comp(session,error,gotPublishActionPermissions);
}
}
}
}];
}
}
The only concern in the following (need a fail safe) is the that the session will switch from open to close over an over and you'll end up with a loop.
I am not able to get the permissions for user_birthday and user_hometown.
I tried it with this code before but it only asks for the public profile and ignores others.
[FBSession openActiveSessionWithReadPermissions:#[#"public_profile",#"user_birthday",#"user_hometown"]
allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
if (error) {
NBAppDelegate* appDel = (NBAppDelegate*)`[UIApplication sharedApplication].delegate;
[appDel sessionStateChanged:session state:status error:error];
}
if ([session isOpen]) {
[self loginWithFBToken:session name:sender];
}
}];
Then someone suggested to ask for additional permissions after getting the public profile, so i even tried that to no good.
Here is the code for that
- (void)loadFbDetails
{
NSArray *permissionsNeeded = #[#"user_hometown", #"user_birthday"];
// Request the permissions the user currently has
[FBRequestConnection startWithGraphPath:#"/me/permissions"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error){
// These are the current permissions the user has:
NSDictionary *currentPermissions= [(NSArray *)[result data] objectAtIndex:0];
// We will store here the missing permissions that we will have to request
NSMutableArray *requestPermissions = [[NSMutableArray alloc] initWithArray:#[]];
// Check if all the permissions we need are present in the user's current permissions
// If they are not present add them to the permissions to be requested
for (NSString *permission in permissionsNeeded){
if (![currentPermissions objectForKey:permission]){
[requestPermissions addObject:permission];
}
}
// If we have permissions to request
if ([requestPermissions count] > 0){
// Ask for the missing permissions
[FBSession.activeSession
requestNewReadPermissions:requestPermissions
completionHandler:^(FBSession *session, NSError *error) {
if (!error) {
// Permission granted
NSLog(#"new permissions %#", [FBSession.activeSession permissions]);
// We can request the user information
[self makeRequestForUserData];
} else {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
}
}];
} else {
// Permissions are present
// We can request the user information
[self makeRequestForUserData];
}
} else {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
}
}];
}
-(void)makeRequestForUserData
{
[FBRequestConnection startWithGraphPath:#"me?fields=birthday,hometown"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
// Sucess! Include your code to handle the results here
NSLog(#"user events: %#", result);
} else {
NSLog(#"error: %#" , error);
}
}];
}
All it does is recursively go between my ios app and the fb native app, returning only with the public_profile in the permissions array.
Looks like i am missing something?
It should work if you're using an admin user of the app. Once you want to use the extended permissions with other users, you have to get your app reviewed by Facebook first.
See my answer here: facebook extended permission
Facebook does not allow apps to access that information by default. You have to ask permission to Facebook for you to be able to use that information. Add a video and instructions for a Facebook employee review how you're using birthday and hometown intel.
I'm trying to share to Facebook using code from their iOS game tutorial. The dialog pops up and the image and text I specified is present, but when I hit "Send" the loading bar appears, doesn't load, then I am redirected to my app. No errors are printed to the console and the app does not crash.
When I go on Facebook to check if the message has posted, I get the following:
"Oops, Something Went Wrong. There was a problem posting your status. We've logged the error and will look into it."
I've used this code in the previous app and it worked perfectly fine. I've updated the Facebook ID, Facebook Display Name, and URL Scheme in the plist.
Here is the code:
FacebookHandler class (derived from Facebook tutorial)
#import "FacebookHandler.h"
#implementation FacebookHandler
+ (void) Facebook_CreateNewSession
{
// initialize Facebook
FBSession* session = [[FBSession alloc] init];
[FBSession setActiveSession: session];
}
+ (void) Facebook_Login
{
NSArray *permissions = [[NSArray alloc] initWithObjects:
#"email",
nil];
// Attempt to open the session. If the session is not open, show the user the Facebook login UX
[FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:true completionHandler:^(FBSession *session, FBSessionState status, NSError *error)
{
// Did something go wrong during login? I.e. did the user cancel?
if (status == FBSessionStateClosedLoginFailed || status == FBSessionStateCreatedOpening) {
// If so, just send them round the loop again
[[FBSession activeSession] closeAndClearTokenInformation];
[FBSession setActiveSession:nil];
[self Facebook_CreateNewSession];
}
else
{
}
}];
}
+ (void) Facebook_PostToNewsFeedWithTitle:(NSString*)title withCaption:(NSString*)caption withDescription:(NSString*)description withLink:(NSString*)link withPictureURL:(NSString*)picURL
{
// check if user is logged in
if ([FBSession activeSession] == nil)
{
[FacebookHandler Facebook_CreateNewSession];
[FacebookHandler Facebook_Login];
}
// This function will invoke the Feed Dialog to post to a user's Timeline and News Feed
// It will attemnt to use the Facebook Native Share dialog
// If that's not supported we'll fall back to the web based dialog.
NSString *linkURL = link;
NSString *pictureURL = picURL;
// Prepare the native share dialog parameters
FBShareDialogParams *shareParams = [[FBShareDialogParams alloc] init];
shareParams.link = [NSURL URLWithString:linkURL];
shareParams.name = title;
shareParams.caption= caption;
shareParams.picture= [NSURL URLWithString:pictureURL];
shareParams.description = description;
if ([FBDialogs canPresentShareDialogWithParams:shareParams]){
[FBDialogs presentShareDialogWithParams:shareParams
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(#"Error publishing story.");
} else if (results[#"completionGesture"] && [results[#"completionGesture"] isEqualToString:#"cancel"]) {
NSLog(#"User canceled story publishing.");
} else {
NSLog(#"Story published.");
}
}];
}else {
// Prepare the web dialog parameters
NSDictionary *params = #{
#"name" : shareParams.name,
#"caption" : shareParams.caption,
#"description" : shareParams.description,
#"picture" : pictureURL,
#"link" : linkURL
};
// Invoke the dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
NSLog(#"Error publishing story.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
NSLog(#"User canceled story publishing.");
} else {
NSLog(#"Story published.");
}
}}];
}
}
#end
My Call
[FacebookHandler Facebook_PostToNewsFeedWithTitle:title withCaption:caption withDescription:description withLink:link withPictureURL:picURL];
UPDATE
It seems to be a problem with the Facebook app. When trying it on a device with Facebook uninstalled, I am asked to log in and then it posts successfully. However, if Facebook is installed, it doesn't post.
I fix it by manually typing the "URL types" key at the plist file.
Don't copy paste the plist values from another plist file - it's Apple's bug!!!
If we call openWithBehavior after a call to closeAndClearTokenInformation, it causes EXC_BAD_ACCESS. Regardless of whether it is using the native iOS built-in dialog or one of the fast-switching ones.
Our code to login to FB, first time through works:
if (![FBSession activeSession]) {
#ifdef FREE_APP
NSString* suffix = #"free";
#else
NSString* suffix = #"paid";
#endif
FBSession *session = [[[FBSession alloc] initWithAppID:#"111111111111111"
permissions:permissions
urlSchemeSuffix:suffix
tokenCacheStrategy:nil] autorelease];
[FBSession setActiveSession:session];
}
else if ([FBSession activeSession].isOpen)
[[FBSession activeSession] close];
[[FBSession activeSession] openWithBehavior:FBSessionLoginBehaviorUseSystemAccountIfPresent
completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
Our code to logout, after which the code above fails after openWithBehavior:
[[FBSession activeSession] closeAndClearTokenInformation];
I was initially using openActiveSessionWithReadPermissions instead of openWithBehavior, as prescribed in the 3.1 docs, which does not crash but the app switching back from FB app/Safari did not work. Perhaps because of the need to have a suffix? If it would be easiest to fix the app switching and go back to that, please advise.
Thanks.
When I ran in the 5.x simulator, I saw an extra, very helpful, error message from openWithBehavior, then looked it up in the source which makes things much more clear:
if (!(self.state == FBSessionStateCreated ||
self.state == FBSessionStateCreatedTokenLoaded)) {
// login may only be called once, and only from one of the two initial states
[[NSException exceptionWithName:FBInvalidOperationException
reason:#"FBSession: an attempt was made to open an already opened or closed session"
userInfo:nil]
raise];
}
I've changed my code to always create a fresh session before calling openWithBehavior and it seems happy.
UPDATE:
Here's the updated code that checks for an active session, then closes it, before always instantiating a fresh session...
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
if ([FBSession activeSession])
[[FBSession activeSession] closeAndClearTokenInformation];
#ifdef FREE_APP
NSString* suffix = #"free";
#else
NSString* suffix = #"paid";
#endif
NSArray *permissions = [[NSArray alloc] initWithObjects:#"email", nil];
FBSession *session = [[FBSession alloc] initWithAppID:mFacebookID
permissions:permissions
urlSchemeSuffix:suffix
tokenCacheStrategy:nil];
[FBSession setActiveSession:session];
If (allowLoginUI == YES) {
NSLog(#"Calling openWithBehavior");
[[FBSession activeSession] openWithBehavior:FBSessionLoginBehaviorUseSystemAccountIfPresent
completionHandler:^(FBSession *session, FBSessionState state, NSError *error)
{
[self sessionStateChanged:session state:state error:error];
}
];
} else if(session.state == FBSessionStateCreatedTokenLoaded) {
NSLog(#"Calling openWith completion handler");
[session openWithCompletionHandler:^(FBSession *_session, FBSessionState status, NSError *error)
{ [self sessionStateChanged:session state:status error:error];}
];
}
[session release];
return true;
}