Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
969 views
in Technique[技术] by (71.8m points)

iphone - Facebook iOS SDK - Strange Effects in Writing to Status

I'm updating my app to use xCode 4, iOS5 and the latest Facebook SDK. All was working fine before.

Now, two strange things are happening and despite reviewing all the code and searching the forums, I can't see why.

See update below.

Logging in for first time

When the user has just logged in, if they either share the status or cancel the attempt to do so, a script is displayed as follows:

<script type="text/javascript"> window.location.href="fbconnect:// success#_=_";
</script>

All other functionality (e..g when its not the first time) seems to work fine.

I suspect this is something to do with call backs not firing, but I've double checked all the delegate setting etc. All the facebook delegate methods are in the appDelegate and then referred to from the view controller.

Has anyone else had this issue? Any pointers would be warmly welcomed. I haven't posted any code yet as I'm not sure which bit to focus on and I've used all the standard code from the facebook developer site.

Many thanks,

Chris.

UPDATE

Thanks to @Kristofer Sommestad and @Senior for their help. I had a number of issues.

Don't Authorise Twice

The feed dialog request also requests an authorisation, so don't request them both at the same time.

Updated SDK

The SDK was updated after I found my issues - so keep checking.

What I hadn't realised was that the required code to use the SDK code had changed, specifically the code to call the feed dialog. Check out https://developers.facebook.com/docs/reference/dialogs/feed/.

What Logout Means

Logging out just logs the user out of your App, not out of facebook.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I also experienced the first issue, but solved it by making sure authentication wasn't triggered twice. Initially, I had done the following:

[_facebook authorize:permissions];
[_facebook dialog:@"feed" andParams:params andDelegate:self];

Not sure this is your problem, but I noticed that this messed things up as it actually triggered 2 authentication dialogs, where the second one ended up with the Javascript output you're also seeing. For some reason I had figured that the second one wouldn't trigger a dialog if authorize already had done so....

Instead, I made sure to authorize: first, but not trigger the dialog:andParams:andDelegate until the authorization was completed with -fbDidLogin (and saving the dialog data to share as an instance variable).

Haven't seen any issues with still being able to post messages, but maybe it's related to the first issue somehow (?).

Hope this helps you out too.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...