Satyam
Satyam

Reputation: 15904

iOS - Integrating Facebook framework

In my iOS app, I successfully integrated latest facebook framework.
Its working fine if "facebook" app is not on my iphone. If the app is not on my iphone, during authentication, its opening the browser and authenticating properly.
But if the facebook app is there on my iphone, after authentication and when returning to my app, its crashing with following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SBJsonParser errorTrace]: unrecognized selector sent to instance 0x2d9f60'


I have seen the samples provided by facebook and implemented the same in my app. Can some one point out me what might be the issue?

Upvotes: 2

Views: 319

Answers (2)

user2155906
user2155906

Reputation: 149

If you want only share something in iOS 6.0 so you use social and account framework and do the job by iPhone internal login using following code

-(void)facebook_Share_in_IOS6.0{

    if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) //check if Facebook Account is linked
    {
        mySLComposerSheet = [[SLComposeViewController alloc] init]; //initiate the Social Controller
        mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; //Tell him with what social plattform to use it, e.g. facebook or twitter
        [mySLComposerSheet setInitialText:[NSString stringWithFormat:@"Test",mySLComposerSheet.serviceType]]; //the message you want to post
    //    [mySLComposerSheet addImage:yourimage]; 

        [self presentViewController:mySLComposerSheet animated:YES completion:nil];
    }else{
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Attention" message:@"First Set your facebook account. To post your answer to facebook" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
    }
    [mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
        NSString *output;
        switch (result) {
            case SLComposeViewControllerResultCancelled:
                output = @"Action Cancelled";
                break;
            case SLComposeViewControllerResultDone:
                output = @"Post Successfull";
                break;
            default:
                break;
        } //check if everything worked properly. Give out a message on the state.
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
    }];
}

Upvotes: 0

deanWombourne
deanWombourne

Reputation: 38475

This is a bit of a stab in the dark but I think you might be calling the method errorTrace on an instance of SBJsonParser :)

What's probably happening is you're calling errorTrace on something that you have released early. Go through the code path triggered when facebook reopens your app and find a call to errorTrace. Set a breakpoint just before it and have a look around to see what's wrong.

Upvotes: 1

Related Questions