Has anyone solved this error message when a user is in the login flow? I tried to toggle my default privacy settings in DevCenter -> Permissions.
I am using the deprecated method in order to both get read and right permissions at the same time. I have other apps successfully using this method.
- (void)openSession
{
[FBSession openActiveSessionWithPermissions:[[NSArray alloc] initWithObjects:#"email",#"publish_actions",#"user_birthday", nil] allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
[self sessionStateChanged:session state:status error:error];
}];
}
I've already replied to your bug report on our developer website(https://developers.facebook.com/bugs/568170979870794).
If you're entering the FacebookDisplayName in your .plist file, it will opt you in for read-write permissions split. What this means is that you can no longer request read/write permissions together(using our deprecated openActiveSessionWithPermissions call). This is not a breaking change but is by design.
Set sandbox mode to no in your application settings in facebook.
I was able to fix this by removing the newly added FacebookDisplayName property ( as of FB SDK 3.5) from the *.plist file.
Opened a bug # facebook:
https://developers.facebook.com/bugs/568170979870794
Related
I just started using facebook sdk and slightly confused with it documentation. It's well written, but very often does not correspond to current SDK version. So i'm not found what to do with this situation:
I request publish permissions when firstly require them, with the next code:
[[FBSession activeSession] requestNewPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
if (error) {
NSLog(#"Permissions request error: %#", error.description);
}
completion(error == nil);
}];
I need only one publish permission - 'publish_actions', when i request it sdk redirects me to facebook app and immediately returns back to the my app without asking whether i'm agree to give this permission.
There are no errors in completionHandler, but through debug i found that this permission was saved in the variable _requestedReauthPermissions:
So, finally, permission i requested not granted to me.
How properly request publish permission? What could I miss? May it occur due to setup of facebook app?
Okay, when I try to open new session with publish permissions and pass array of permissions, facebook sdk pops up me an error. com.facebook.sdk code 2 error (which has a lot of explanations and I'm pretty sure that I tried almost everything from here).
That looks something like this:
permissions = [NSArray arrayWithObjects:#"publish_actions", #"publish_stream", nil];
[FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceFriends allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
if I say: permissions = nil; And call this same thing, everything works okay. After that, I am able to call same function WITH permissions and user is able to post directly on facebook (directly on wall). Am I missing something?
I'm working with latest facebook sdk (3.8 I think) and testing on device with 6.1.4 version iOS.
Maybe I should try to call requestNewPublishPermissions for an active session after opening new session with nil permissions?
In the last SDK, read and publish permissions are separated. So, in my code, whenever the users logs in I am using this code:
[FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
I have seen in the facebook developer that when I want to publish, I should ask for publish permissions like this:
// can include any of the "publish" or "manage" permissions
NSArray *permissions =
[NSArray arrayWithObjects:#"publish_actions", nil];
[[FBSession activeSession] reauthorizeWithPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
/* handle success + failure in block */
}];
Since this is my first app that I am using facebook integration, I want to ask a couple of things:
1) Can these sessions be open at the same time? I will ask for the publish permissions only when the user wants to publish, but should I do something else with the other session? Like close it first, and reopen it later or I should not worry about?
2) If I have a postToFriends button for example, my pseudocode for making it work would be like this, right?
- (IBAction)postToFriendaction:(id)sender {
if (!FBSession.activeSession.isOpen) {
/* code from the above for enabling publish permissions*/
}
or I should change !FBSession.activeSession.isOpen to something else, because no the user is logged in with read permission only, he never enters the if clause. Can you help me?
The two sessions you refer to are actually the same session (it's the "active" session that's statically available after a call to openActiveSession... is called). So you don't need to do anything with the other session.
You should have a look at either the Scrumptious or Hello Facebook sample apps that ship with the SDK. They both give examples on how to post (while asking for publish permissions).
I'm sure there's something simple I'm missing regarding this, but when using requestForUploadPhoto to send a photo to an album, it gets sent up with permission set to 'Only me'. Because the permission setting is so restrictive, photos then need to be manually approved by the user. Is there a way to alter the default upload permission (which will hopefully stop it requiring manual approval)? Normally it would be set when requesting a publish permission, but because user_photos is technically a read permission, I'm not given the chance to specify this. Code is below.
[FBSession openActiveSessionWithReadPermissions:[NSArray arrayWithObject:#"user_photos"] allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
FBRequest* request = [FBRequest requestForUploadPhoto:uploadImage];
FBRequestConnection* connection = [[FBRequestConnection alloc] init];
[connection addRequest:request completionHandler:^(FBRequestConnection* connection, id result, NSError* error)
{ NSLog(#"Done with upload"); }];
[connection start];
}];
I know it's not even slightly close in terms of catching and managing other session changes, but I'm not fussed with that atm - I just want to get this permission issue resolved before coding the rest.
user_photos only allows you to see photos (using GET), and does not allow you to post a photo. To do that, you need either publish_stream or publish_actions. Are you sure your app didn't already have a publish permission somehow?
You are correct in that the privacy is set when an app requests publish permissions, and the user can change that at any point later on as well (via the Facebook app or website).
I am developing a facebook app and is wondering how to set the permission array.
in the Facebook SDK version before all I need to do is create an instance from Facebook.h and set the permission. But now the facebook.h file is no long there, and stopped work for SDK3.0 and 3.1.
Facebook said to import the depreciated files but if I do that I get lots of errors, so that didn't work at all.
and I cannot find any documents regard setting permission property on iOS 5 and later, could someone help me out?
thanks!!
[FBSession openActiveSessionWithPublishPermissions:[[NSArray alloc] initWithObjects:#"publish_stream",#"email", nil]
defaultAudience:FBSessionDefaultAudienceFriends
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
you can find a short tutroail and simple code samples in http://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/