Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I followed this tutorial on installing FBConnect in an application. I know it is slightly outdated and there are newer ones, but all I need FB for in my app is very simple post to wall commands, so this one is the one I used. Not to sound harsh but I'm not interested in a completely different way of doing it, just debugging the problem I have.

I follow the tutorial to the letter, set everything up in my .h file, link everything correctly in IB. Here is the line of code that is giving me fits.
Code:
- (IBAction) posttowall {
_posting = YES;
			// If we're not logged in, log in first...
			if (![_session isConnected]) {
				self.loginDialog = nil;
				_loginDialog = [[FBLoginDialog alloc] initWithSession:_session];	
				[_loginDialog show];	
			}
			// If we have a session and a name, post to the wall!
			else if (_facebookName != nil) {
				[self postToWall];
			}
}
Here is the issue. My app is TabBar and on each tab is a different blog or webpage. Therefore, I have this code in every ViewController, each with a different PosttoWall void statement to fit what is in the ViewController. The tutorial I listed says to leave
Code:
_loginDialog = [[FBLoginDialog alloc] initWithSession:_session];
as this
Code:
_loginDialog = [[FBLoginDialog alloc] init];
If I then run this code, it will have me log in to facebook, then say redirecting, but never pop up the publish story to wall window. If I leave it
Code:
_loginDialog = [[FBLoginDialog alloc] initWithSession:_session];
the first Viewcontroller will work perfectly, but all the other tabs viewcontrollers will terminate after logging in, with an error of _session key returning nil. How can I fix it where when I click and login it will automatically pull the Publish Story to Wall window?

To moderator:
Please delete prior thread of Strangest problem, and leave this open. I believe this better explains the issue. Thank you.
 
An app I made was released today. The code for the ibaction was this one.
Code:
_loginDialog = [[FBLoginDialog alloc] init];[\CODE]
for some after they login it pops up the publish to wall part just fine. For others, it says redirecting but won't give the option to post to the wall. If it's all the same code, why does it work for some and not others?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.