I have my Facebook fanpage setup and a button in my app 'Like us on Facebook'.
The code I have to do this is
Code:
-(IBAction)facebookButtonClicked
{
NSURL *pageURL = [NSURL URLWithString:@"fb://profile/myappid"];
if (![[UIApplication sharedApplication] openURL: pageURL])
{
//if user doesn't have Facebook app installed open in Safari
NSURL *webURL = [NSURL URLWithString:@"http://www.facebook.com/myapp"];
[[UIApplication sharedApplication] openURL: webURL];
}
}
If I have previously opened Facebook and have it running as a background process and click the button in my app, it works correctly and goes to the page.
The problem is if Facebook isn't running already and I click the button...it seems as though it's working, it starts to open the Facebook app...it stays on the Facebook splash screen for 5-10 secs than it just crashes.
In the Facebook app Crash Logs for when this happens I get this
Code:
Exception Type: 00000020
Exception Codes: 0x8badf00d
Highlighted Thread: 0
Application Specific Information:
com.facebook.Facebook failed to launch in time
Is this a known bug? Or am I doing something wrong?
Thanks!