« Street Fighter IV now on the IPHONE! | Main | The little things »

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54fe20d0088330120a9297597970b

Listed below are links to weblogs that reference Add Facebook Connect to a Unity iPhone Game:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Tim Seymor

Love this!

PepperGum Games

This is going in all my Unity games now that it's succinctly laid out.

Mango

HI
Does this work for Unity iphone basic or only on the professional version?

Ontario Britton

This works with both Unity iPhone Basic and Advanced. This is meant particularly for iPhone Basic since iPhone Advanced doesn't need the NSUserDefaults work around to access objective-C calls.

ken

I'm getting a error right at the end
I think i'm not to clear on where to place this line.
[self postToFacebookWithKey: keyPath andValue: val];

If anyone can help that would be awesome.

Ontario Britton

postToFacebookWithKey should be called in observeValueForKeyPath when your NSUserDefault is set.

ken


I'm sure I'm doing this all wrong . even after i moved it

I think I follow it pretty good up to Integrating Facebook section. Here is a zip of me trying it in a clean unity3d iphone project.
If anyone has time I would be greatful...


http://kennorman.com/files/example.zip

ken

you might have to click the link . highlight it and then hit enter... well that what i had to do :)

ken

Here are the two error to go with that file.

/Users/kennorman/facebook/facebookpush/build/facebookpush.app/facebookpush
Undefined symbols:
"_OBJC_CLASS_$_FBSession", referenced from:
__objc_classrefs__DATA@0 in AppController.o
"_OBJC_CLASS_$_FBLoginDialog", referenced from:
__objc_classrefs__DATA@0 in AppController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
"_OBJC_CLASS_$_FBSession", referenced from:
__objc_classrefs__DATA@0 in AppController.o
"_OBJC_CLASS_$_FBLoginDialog", referenced from:
__objc_classrefs__DATA@0 in AppController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build failed (2 errors)

Ontario Britton

Since you're getting a linker error when you try integrating facebook, I wonder if your header search path to facebook-connect is correct? I would try empirically recreating the example I give, to verify whether that was the problem. If so, then take some more time getting your search path pointed to the right directory level. This tripped me up a little at first too.

ken

when I copied the FBConnect folder over I had to place it in the Classes folder for the import to find it and then i had to change the imports in alot of files .. I think this was the beginning of my down fall..

Add #import "FBConnect/FBConnect.h" to AppController.h

joan

hi!

im getting a error:

'val' was not declared in this scope

thanks in advance,
Joan

joan

done.
thanks anyway :)

iPhone 4 addict

I wonder if the tips can also be done for iPhone 4... I'm so gonna try it!

Purpleslurple

"Another requirement is to handle the callback when a login is successful" My implementation seems to be failing here. After the user clicks the connect button I get a short message from FB that it's "redirecting". The user gets logged in but the post dialog doesn't appear. Note that if the user revisits my page the post dialog appears as it should (login being cached).

I've got the code in place, all looks good/works except callback/redirect is failing. just wondering if anyone had encountered this and what they did to resolve.

Thanks in advance.

Opticfibre

ONTARIO BRITTON

Did you resolve your linker errors, i get the same 2 errors?

Cheers

Opticfibre

are the search paths in the Header Search Path or User Search Path.

If i remove my search path, the app wont compile at all saying FBconnect.h not found. 16 errors

Putting my search path back in compiles but for 3 errors

"_OBJC_CLASS_$_FBSession", referenced from:
__objc_classrefs__DATA@0 in AppController.o


"_OBJC_CLASS_$_FBStreamDialog", referenced from:
__objc_classrefs__DATA@0 in AppController.o


"_OBJC_CLASS_$_FBLoginDialog", referenced from:
__objc_classrefs__DATA@0 in AppController.o


ld: symbol(s) not found


These look like linker errors, but what to do?

Opticfibre

To whom it may concern, regarding the linker errors,

My problem was not reading the tutorial correctly, the tutorial says to drag the FBConnect folder FROM THE FACEBOOK XCODE PROJECT FOLDER.

I was dragging it from src/FBConnect which was causing the errors, my bad.

Thats a couple of days i could have gained back if i had of realised

Opticfibre

IPHONE 4 ADDICT

Yes im all working now except for the redirecting thing, and havinf to press the Facebook connect button again, and then being presented with the post message window?

Anyone.... anyone,,,, Bueller

Nsnarvekar

Thanks for this great post.
I am getting "Not Published Yet via Mobile MKAbeFook" this line at the bottom while posting feed in webview.

I want to change this line. I tried but still not able to solve it.

In your app you have edited text. Can you show me the good way to do this?
Please.

Patrick

A lot of people are having a hard time logging into facebook recently. Check out the articles and comments at facebook login, there's some really useful tips!

Free iPhone 4

I haven't tried this game but I believe this is a cool one for iPhone users. Thanks for sharing this.

fred

Hello!
Fantastic tutorial, I was able to go through without any compiling errors. Great stuff!
Unfortunately, it seems that none of my posting to facebook show up on my facebook page. Does the facebook application need to be registered to work? (More than 5 users I think...).
Cheers and thanks again!

fred

Actually... it works! I was just posting at the wrong address!

Piyushroongta

hiii

i am new in the field of unity development. i want implement the feature of facebook in my game but i am unable to understand the first step can u explain it in more detail like what is PlayerPref and where i have to add the following script:

var invisible : GUIStyle;

private var currentFortune : String = "Plan for many pleasures ahead.";

function OnGUI()

{

if( GUI.Button( Rect( 100, 260, 120, 40 ), "", invisible ))

{

PlayerPrefs.SetString("Fortune", currentFortune);

}

}

please help

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Latest Posts and Photos

  • 7-620x380
  • Layout
  • 438px-VectorBitmapExample.svg
  • Rast-vect
  • Ligatures
  • Wlk01
  • Apple-small
  • Nike_swoosh
  • House-simple
  • Home
  • IMG
  • Screen shot 2010-06-29 at 9.43.29 AM
  • Screen shot 2010-06-29 at 9.43.24 AM
  • Killing-620x380
  • Green
  • Mac-mini-big-cjr
  • IPhone-Size-Comparison-2
  • Lemur-620x380
  • Gyroscope
  • Wikipedia
  • Wikipedia_logo_dec08
  • Wired-620x380
  • Samsung-Galaxy-Tab-Android-Tablet
  • YourReach-620x380
  • Themasses-620x380