Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-08-2012, 04:00 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Location: Montreal, Canada
Posts: 104
esoteric is on a distinguished road
Default Opening Facebook App from within my app glitch

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!
esoteric is offline   Reply With Quote
Old 02-10-2012, 12:09 AM   #2 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 94
JamesCahall is on a distinguished road
Default

Quote:
Originally Posted by rrlemoine View Post
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!
The Facebook app has gone through many changes of its url scheme and what points to what. It could be the case that Facebook apps needs you to point to:

fb://pages/APPID instead of fb://profiles/APPID

See the full list of url schemes here (maybe not up to date):
IPhone URL Schemes - akosma wiki
JamesCahall is offline   Reply With Quote
Old 02-10-2012, 12:28 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2011
Location: Montreal, Canada
Posts: 104
esoteric is on a distinguished road
Default

Quote:
Originally Posted by JamesCahall View Post
The Facebook app has gone through many changes of its url scheme and what points to what. It could be the case that Facebook apps needs you to point to:

fb://pages/APPID instead of fb://profiles/APPID

See the full list of url schemes here (maybe not up to date):
IPhone URL Schemes - akosma wiki
Before trying the fp://pages i thought i'd give what i had a shot one more time and now it works correctly, with Facebook app being closed before clicking on my button.

So i guess there is no problem with fb://profile/APPID , perhaps my phone just needed to be rebooted(which i had done this morning) or something?

I also tried the fb://pages/APPID just for fun and it would open the Facebook app but not load any page.

Thanks for the reply!
esoteric is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 388
12 members and 376 guests
7twenty7, chiataytuday, fiftysixty, gmarro, iOS.Lover, KennyChong, kilobytedump, Leslie80, Matrix23, ryantcb, stanny, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:21 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0