2

Just upgraded to the Facebook iOS SDK 3.1 and already running into problems.

My app can't find the facebook method reauthorizeWithPublishPermissions, and it also hasn't got a clue what the static FBSessionDefaultAudienceFriends definition is!

Anyone else seen these problems? Can't believe that the 3.1 SDK would have these basic bugs in it, so I'm blaming my stupidity for now!!

For completeness, here is my code:

[FBSession reauthorizeWithPublishPermissions:[NSArray arrayWithObjects:@"publish_stream", @"publish_actions",nil]
    defaultAudience:FBSessionDefaultAudienceFriends 
    completionHandler:^(FBSession *session, NSError *error) {

        // Do something...

}];

Thanks.

2
  • Going to have to ask & check that you've linked in the new SDK correctly (cleaned project etc). They're both definitely there in FBSession.h! Sep 27, 2012 at 7:32
  • Thanks James, slap'o'the'head moment! Also as Zotter said, it was an instance method. Sep 28, 2012 at 14:33

4 Answers 4

3

@Zotter, answer is depreciated. Now (with latest Facebook iOS SDK, I guess v.3.19) you've to use - (void)requestNewReadPermissions:(NSArray *)readPermissions completionHandler:(FBSessionRequestPermissionResultHandler)handler; method, to authorise app with publish permissions.

[FBSession.activeSession requestNewPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
    if(!error) {

    }
}];
2
 /*! No audience needed; this value is useful for cases where data will only be read from Facebook */

    FBSessionDefaultAudienceNone                = 0,
    /*! Indicates that only the user is able to see posts made by the application */
    FBSessionDefaultAudienceOnlyMe              = 10,
    /*! Indicates that the user's friends are able to see posts made by the application */
    FBSessionDefaultAudienceFriends             = 20,
    /*! Indicates that all Facebook users are able to see posts made by the application */
    FBSessionDefaultAudienceEveryone            = 30,
1

reauthorizeWithPublishPermissions: is an instance method

  [FBSession.activeSession reauthorizeWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceFriends completionHandler:
     ^(FBSession *session,
       NSError *error)
     {
         ...
     }];
0

I had this problem. I was using an old version of Cocoapods that wasn't properly upgrading the source from 3.0 to 3.1. If you're using Cocoapods, upgrade to 0.14.0 and try again. If not, double check to make sure you have the latest Facebook SDK from master - if you don't see those values in FBSession.h, you probably have an old version of the SDK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.