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 10-05-2011, 04:17 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2009
Location: Sheffield UK
Posts: 21
crooksy88 is on a distinguished road
Default Facebook iOS SDK not returning to my app

I'm trying to implement the new oAuth2 facebook SDK into my app but can't for the life of me understand how I'm supposed to get back to my app once logged in/authenticated.

My goal is to post a message on the users wall.

I am currently starting the login procedure with this:

Code:
-(void)tryFBlogin {

NSString *appId = @"113142482******";

NSArray *permissions =  [[NSArray arrayWithObjects:@"publish_stream",nil] retain];

TheAppDelegate *theAppDelegate = (TheAppDelegate *)[[UIApplication sharedApplication]delegate];

//Asking for permission
theAppDelegate = (TheAppDelegate *)[[UIApplication sharedApplication] delegate];
theAppDelegate.facebook = [[Facebook alloc] initWithAppId:appId andDelegate:self];
Facebook *fb = [theAppDelegate facebook];
[fb  authorize:permissions];

}
which is opening a safari browser. If I'm already logged in and have the app authorized a message will tell me so and I have an OKay button to press.

When I press the OKay button I get an alert saying safari cannot open the page. I confirm the alert and am left looking at a blank safari window.

If I'm logged out of facebook I am presented with the login screen which I fill in and am then presented with the same as above.

I understand that I haven't implemented the publish command anywhere yet as I don't know where/when this should be implemented.

I do have this delegate method in place but this seems to never get called

Code:
- (void)fbDidLogin {

    NSLog(@"fbDidLogin");
}
This is the code I have waiting to place somewhere:

Code:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, @"113142482******",
facebookUrl, @"link",
@"http://www.domain.com", @"picture",
@"My Message", @"name",
@"Caption text!", @"caption",
@"Message text.",  @"message",
nil];
[facebook dialog:@"feed" andParamsarams andDelegate:self];
I also have the following methods in my apps main AppDelegate:

Code:
-(BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url{
    [facebook handleOpenURL:url]; 
return YES; 
}
Any help/suggestions would be very much appreciated.

Thanks

Mark
__________________
Apps available in the AppStore:
---
24 Countdown Clock
MeerKat
TechSolver

Last edited by crooksy88; 10-06-2011 at 01:39 AM.
crooksy88 is offline   Reply With Quote
Reply

Bookmarks

Tags
facebook, ios, sdk

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: 404
18 members and 386 guests
13dario13, 7twenty7, eski, EvilElf, glenn_sayers, HemiMG, iOS.Lover, jarv, LunarMoon, n00b, pbart, Pudding, QuantumDoja, sacha1996, Sami Gh, UMAD, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

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