<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Topic: My Tutorial: Using Facebook Connect w/ Cocos2d</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/3392</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 01:45:23 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/topic/3392" rel="self" type="application/rss+xml" />

		<item>
			<title>idontchick on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-113506</link>
			<pubDate>Tue, 30 Aug 2011 20:15:12 +0000</pubDate>
			<dc:creator>idontchick</dc:creator>
			<guid isPermaLink="false">113506@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>yeah, theres no more fbsession<br />
what to do
</p></description>
		</item>
		<item>
			<title>isaac on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-107316</link>
			<pubDate>Wed, 27 Jul 2011 10:39:33 +0000</pubDate>
			<dc:creator>isaac</dc:creator>
			<guid isPermaLink="false">107316@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>i'm using latest facebook connect.. there's no fbsession anymore T^T</p>
<p><code>[self.facebook dialog:@&#34;oauth&#34; andParams:params andDelegate:self];</code></p>
<p>the above line runs without error but the dialog didn't show..</p>
<p>    `FBLoginDialog* dialog = [[[FBLoginDialog alloc] init] autorelease];<br />
    dialog.delegate = self;<br />
    dialog.params = params;<br />
    dialog.permission = @"publish_stream";<br />
    [dialog show];`</p>
<p>the above runs, a dialog shows up but immediately it close...</p>
<p>anyone has any ideas or any lead? thanks!
</p></description>
		</item>
		<item>
			<title>zaaroth on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-103343</link>
			<pubDate>Thu, 07 Jul 2011 05:23:50 +0000</pubDate>
			<dc:creator>zaaroth</dc:creator>
			<guid isPermaLink="false">103343@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Sorry, I just followed the piece of code you provided.</p>
<p>The crash at:<br />
<code>[params setObject:_appId forKey:@&#34;app_id&#34;];</code></p>
<p>says it all. Somehow your appId is nil at that point.</p>
<p>I havent seen the code on this thread, its just too long. </p>
<p>Anyway, you got to backtrack the changes (or perhaps the changes that still didnt occur) on _appId to find out why its nil. So sad to state the obvious :-(
</p></description>
		</item>
		<item>
			<title>PAj on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-103337</link>
			<pubDate>Thu, 07 Jul 2011 04:26:34 +0000</pubDate>
			<dc:creator>PAj</dc:creator>
			<guid isPermaLink="false">103337@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Maybe a little more info  as to where I set app_id may help.</p>
<p>In my fbClass.h I do:<br />
<pre><code>Facebook *facebook;</code></pre>
<p>In my fbClass.mm I do:<br />
<pre><code>- (void) facebookLogin
{

	if (facebook == nil) {
		facebook = [[Facebook alloc] initWithAppId:@&#34;fb136801456409999&#34;];
	}	

	NSArray* permissions =  [[NSArray arrayWithObjects:
			@&#34;publish_stream&#34;, @&#34;offline_access&#34;, nil] retain];

	[facebook authorize:permissions delegate:self];
}</code></pre></description>
		</item>
		<item>
			<title>PAj on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-103334</link>
			<pubDate>Thu, 07 Jul 2011 04:18:53 +0000</pubDate>
			<dc:creator>PAj</dc:creator>
			<guid isPermaLink="false">103334@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>This code came directly from jorgevmendoza's post in this thread:</p>
<pre><code>NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
			@&#34;your app fb id&#34;, @&#34;api_key&#34;,
			 @&#34;Share on Facebook&#34;,  @&#34;user_message_prompt&#34;,
			 actionLinksStr, @&#34;action_links&#34;,
			attachmentStr, @&#34;attachment&#34;,
			nil];</code></pre>
<p>I simply substituted in my app fb id and in error my app_key.</p>
<p>I just tried it like this:</p>
<pre><code>NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
		//@&#34;fb136801456409999&#34;, @&#34;app_id&#34;,
                @&#34;f795be5552385eea519fc202d9b99999&#34;, @&#34;app_key&#34;,
		@&#34;Share on Facebook&#34;,  @&#34;user_message_prompt&#34;,
		actionLinksStr, @&#34;action_links&#34;,
		attachmentStr, @&#34;attachment&#34;,
		 nil];</code></pre>
<p>And still the same error.</p>
<p>But then I put in a breakpoint and found I crash in Facebook.m line 604:</p>
<pre><code>[params setObject:_appId forKey:@&#34;app_id&#34;];</code></pre></description>
		</item>
		<item>
			<title>zaaroth on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-103320</link>
			<pubDate>Thu, 07 Jul 2011 02:41:48 +0000</pubDate>
			<dc:creator>zaaroth</dc:creator>
			<guid isPermaLink="false">103320@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I think:</p>
<pre><code>NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
		@&#34;136801456409999&#34;, @&#34;f795be5552385eea519fc202d9b99999&#34;,
		@&#34;Share on Facebook&#34;,  @&#34;user_message_prompt&#34;,
		actionLinksStr, @&#34;action_links&#34;,
		attachmentStr, @&#34;attachment&#34;,
		 nil];</code></pre>
<p>Should be something like:<br />
<pre><code>NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
		@&#34;136801456409999&#34;, @&#34;app_id&#34;,
                @&#34;f795be5552385eea519fc202d9b99999&#34;, @&#34;something_else&#34;,
		@&#34;Share on Facebook&#34;,  @&#34;user_message_prompt&#34;,
		actionLinksStr, @&#34;action_links&#34;,
		attachmentStr, @&#34;attachment&#34;,
		 nil];</code></pre>
<p>Nor sure, though. What is clear is that you are not passing a value for the app_id field. This piece of code is probably not the dictionary the app is complaining about because there isnt any app_id key there.
</p></description>
		</item>
		<item>
			<title>PAj on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-103316</link>
			<pubDate>Thu, 07 Jul 2011 01:35:05 +0000</pubDate>
			<dc:creator>PAj</dc:creator>
			<guid isPermaLink="false">103316@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Great thread!</p>
<p>However, I continue to get this error:</p>
<p>[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: app_id)</p>
<p>on this piece of code:<br />
<pre><code>NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
		@&#34;136801456409999&#34;, @&#34;f795be5552385eea519fc202d9b99999&#34;,
		@&#34;Share on Facebook&#34;,  @&#34;user_message_prompt&#34;,
		actionLinksStr, @&#34;action_links&#34;,
		attachmentStr, @&#34;attachment&#34;,
		 nil];</code></pre>
<p>obviously it doesn't like the app_ID I've put in there (136801456409999) so I've tried:</p>
<p>fb136801456409999 and used the App Key value instead but still get this error.</p>
<p>I even created 5 different apps and nothing works.</p>
<p>Am I overlooking something here?</p>
<p>Regards,</p>
<p>Joseph<br />
------------------------------<br />
<a href="http://www.prestoarts.com" rel="nofollow">http://www.prestoarts.com</a><br />
<a href="http://itunes.apple.com/us/app/zombie-toss-basketball/id436247664?mt=8&#038;ls=1" rel="nofollow">http://itunes.apple.com/us/app/zombie-toss-basketball/id436247664?mt=8&#038;ls=1</a><br />
<a href="http://youtu.be/gFTUBOPXRSY" rel="nofollow">http://youtu.be/gFTUBOPXRSY</a><br />
<a href="http://twitter.com/PrestoArts" rel="nofollow">http://twitter.com/PrestoArts</a>
</p></description>
		</item>
		<item>
			<title>David Axe on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-90877</link>
			<pubDate>Sat, 30 Apr 2011 15:30:22 +0000</pubDate>
			<dc:creator>David Axe</dc:creator>
			<guid isPermaLink="false">90877@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi<br />
I am struggling to integrate Facebook into my project.<br />
I used Jorge's code to help me.<br />
I click on the facebook image and it takes me to safari with a message saying "an error has occurred please try again later".<br />
There was a warning with the code:<br />
<code>[fb authorize:@&#34;your fb api code&#34; permissions:_permissions delegate:self];</code><br />
warning: 'Facebook' may not respond to '-authorize:permissions:delegate:'<br />
so I altered it to:<code>[fb authorize:_permissions delegate:self];</code><br />
Is this right?</p>
<p>Also, the permissions code <code>[[FBRequest requestWithDelegate:self] call:@&#34;facebook.fql.query&#34; params:params];</code><br />
came up with the following warning: warning: 'FBRequest' may not respond to '+requestWithDelegate:'<br />
so altered it to: <code>[FBRequest getRequestWithParams:params httpMethod:@&#34;facebook.fql.query&#34; delegate:self requestURL:@&#34;facebook.fql.query&#34;];</code><br />
is that right?</p>
<p>Any advice would be really appreciated as I am stuck.</p>
<p>Thanks<br />
David
</p></description>
		</item>
		<item>
			<title>gangcil on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-68869</link>
			<pubDate>Thu, 30 Dec 2010 08:34:43 +0000</pubDate>
			<dc:creator>gangcil</dc:creator>
			<guid isPermaLink="false">68869@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>i also need to integrate FB with cocos2d v99.5....but i actually can't find the way :((
</p></description>
		</item>
		<item>
			<title>wolves on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-68396</link>
			<pubDate>Mon, 27 Dec 2010 05:23:36 +0000</pubDate>
			<dc:creator>wolves</dc:creator>
			<guid isPermaLink="false">68396@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Has anyone been able to integrate the new Facebook SDK with Cocos2d? I'm having trouble figuring out where to put everything so some sample code would be really helpful. Thanks!
</p></description>
		</item>
		<item>
			<title>jorgevmendoza on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-64333</link>
			<pubDate>Tue, 23 Nov 2010 20:56:01 +0000</pubDate>
			<dc:creator>jorgevmendoza</dc:creator>
			<guid isPermaLink="false">64333@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/13743'>cocojoe</a>, Yup, i was able to implement those Delegates, once more, thanks jou :D
</p></description>
		</item>
		<item>
			<title>cocojoe on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-64265</link>
			<pubDate>Tue, 23 Nov 2010 14:06:36 +0000</pubDate>
			<dc:creator>cocojoe</dc:creator>
			<guid isPermaLink="false">64265@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/11454'>jorgevmendoza</a> if you are asking about how to implement a delegate, just look at page 1 of this thread as it shows you.
</p></description>
		</item>
		<item>
			<title>jorgevmendoza on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-64148</link>
			<pubDate>Mon, 22 Nov 2010 17:17:17 +0000</pubDate>
			<dc:creator>jorgevmendoza</dc:creator>
			<guid isPermaLink="false">64148@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/13743'>cocojoe</a></p>
<p>This question is going to sound very stupid but, how can i do that? am using :<br />
<pre><code>Facebook * fb = [[Facebook alloc]init];
.
..
...
[fb dialog: @&#34;stream.publish&#34; andParams: params andDelegate:self];</code></pre>
<p>Regards,</p>
<p>Jorge
</p></description>
		</item>
		<item>
			<title>cocojoe on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-64090</link>
			<pubDate>Mon, 22 Nov 2010 09:16:22 +0000</pubDate>
			<dc:creator>cocojoe</dc:creator>
			<guid isPermaLink="false">64090@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/11454'>jorgevmendoza</a></p>
<p>Yes, you need to support FBSessionDelegate and FBDialogDelegate
</p></description>
		</item>
		<item>
			<title>jorgevmendoza on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-64035</link>
			<pubDate>Mon, 22 Nov 2010 02:49:51 +0000</pubDate>
			<dc:creator>jorgevmendoza</dc:creator>
			<guid isPermaLink="false">64035@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/13743'>cocojoe</a>, this is a very good stuff! i had been looking for a way to resolve this, cause i didn't know a way to handle the events once the fb dialog was on screen, are this methods on the fb delegate?</p>
<p>regards.</p>
<p>Jorge.
</p></description>
		</item>
		<item>
			<title>cocojoe on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-63144</link>
			<pubDate>Sun, 14 Nov 2010 11:58:48 +0000</pubDate>
			<dc:creator>cocojoe</dc:creator>
			<guid isPermaLink="false">63144@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>In the end I went with disabling my layer menu / fading children to grey / pause ccdirector while dialog is in use.  </p>
<p>I am launching the login dialog which is followed by a publish dialog, the user can cancel out of either one of these and the delegates are different, so you need to watch both if like me you are using these to restore the layer menu.</p>
<pre><code>// Came out of Login Screen
- (void)fbDidNotLogin:(BOOL)cancelled {</code></pre>
<pre><code>// Came out of Publish Dialog
- (void)dialogDidNotComplete:(FBDialog *)dialog {</code></pre>
<pre><code>// Completed Publish Dialog
- (void)dialogDidComplete:(FBDialog *)dialog
{</code></pre>
<p>Anyway works nicely on iPad now.
</p></description>
		</item>
		<item>
			<title>cocojoe on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-63068</link>
			<pubDate>Sat, 13 Nov 2010 17:50:48 +0000</pubDate>
			<dc:creator>cocojoe</dc:creator>
			<guid isPermaLink="false">63068@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Perhaps more of a general Objective C question however it is related, on iPhone the FB popup dialog screen takes up the entire screen so there is no chance of anyone pressing any other MenuItems.</p>
<p>However on the iPad the dialog is a small popup, if I hit 'next scene' for example the FB Dialog will stay on screen and if you press a button it will then crash the app as I assume it is trying to access the delegate that belonged to the scene that was just deallocated?
</p></description>
		</item>
		<item>
			<title>arcticfire on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-62690</link>
			<pubDate>Wed, 10 Nov 2010 17:36:42 +0000</pubDate>
			<dc:creator>arcticfire</dc:creator>
			<guid isPermaLink="false">62690@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/11454'>jorgevmendoza</a> i have all my other methods, and stuff.<br />
but it still doesnt work, i have a feeling im using a wrong version of the faebook sdk
</p></description>
		</item>
		<item>
			<title>jorgevmendoza on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392/page/2#post-62586</link>
			<pubDate>Tue, 09 Nov 2010 23:03:27 +0000</pubDate>
			<dc:creator>jorgevmendoza</dc:creator>
			<guid isPermaLink="false">62586@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi @<a href='http://www.cocos2d-iphone.org/forum/profile/21952'>arcticfire</a>, mine is working with that very same code, check if you did copy and paste, you must fill your own init method //...al you scene elements.....</p>
<p>Regards.</p>
<p>Jorge.
</p></description>
		</item>
		<item>
			<title>arcticfire on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-61864</link>
			<pubDate>Wed, 03 Nov 2010 22:56:56 +0000</pubDate>
			<dc:creator>arcticfire</dc:creator>
			<guid isPermaLink="false">61864@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/11454'>jorgevmendoza</a> i got this working last night (nov 2) and today (nov 3) it keeps returning EXC_BAD_ACCESS....<br />
what the heck it wrong? i read that facebook did something new, but does that affect this????
</p></description>
		</item>
		<item>
			<title>jorgevmendoza on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-61607</link>
			<pubDate>Tue, 02 Nov 2010 15:43:59 +0000</pubDate>
			<dc:creator>jorgevmendoza</dc:creator>
			<guid isPermaLink="false">61607@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi Jeston,<br />
Thanks for this tutorial, but looks like the new version of fb connect api is totally different, yesterday i did finish one game using the new version of the fb connect and i would like to post how to use the new version, may be not with as much details as your post does but with the main ideas with a little code samples</p>
<p>First create the header of the class that will use the fbconnect api :</p>
<p><strong>SocialScene.h</strong></p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;Foundation/Foundation.h&#62;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;FBConnect.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;FBRequest.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;CoverScreen.h&#34;

@interface SocialScene : CCLayer &#60;FBSessionDelegate, FBRequestDelegate, FBDialogDelegate&#62; {
	Facebook * fb;
	NSString * fbmessage;
}
@property(nonatomic,retain) NSString * fbmessage;
-(void)postFbMessage;
@end</code></pre>
<p>and the .m file, with the connect and posting methods:</p>
<p><strong>SocialScene.m</strong></p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;SocialScene.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;CoverScreen.h&#34;

@implementation SocialScene
@synthesize fbmessage;
+(id) scene
{
	// &#39;scene&#39; is an autorelease object.
	CCScene *scene = [CCScene node];

	// &#39;layer&#39; is an autorelease object.
	SocialScene *layer = [SocialScene node];

	// add layer as a child to scene
	[scene addChild: layer];

	// return the scene
	return scene;
}

// on &#34;init&#34; you need to initialize your instance
-(id) init
{
	// always call &#34;super&#34; init
	// Apple recommends to re-assign &#34;self&#34; with the &#34;super&#34; return value
	if( (self=[super init] )) {
		// ask director the the window size
		CGSize size = [[CCDirector sharedDirector] winSize];

		fb = [[Facebook alloc]init];

	//...al you scene elements.....
	}
	return self;
}

-(void)fbLoginTapped:(id)Sender
{
	[[SimpleAudioEngine sharedEngine] playEffect:@&#34;buttonclick.wav&#34;];
	NSArray *_permissions =  [[NSArray arrayWithObjects:
                      @&#34;publish_stream&#34;, @&#34;offline_access&#34;,nil] retain];
	[fb authorize:@&#34;your fb api code&#34; permissions:_permissions delegate:self];
}

-(void)BackTapped:(id)Sender
{
	[[SimpleAudioEngine sharedEngine] playEffect:@&#34;buttonclick.wav&#34;];
	[fb logout:self];
	[fb release];
	[[CCDirector sharedDirector] replaceScene:[CoverScreen node]];
}

-(void)PostTapped:(id)Sender
{
	[[SimpleAudioEngine sharedEngine] playEffect:@&#34;buttonclick.wav&#34;];
	if([fb isSessionValid])
	{
		NSLog(@&#34;isvalid!&#34;);
	[self postFbMessage];
	}
	else
	{
		NSLog(@&#34;Notvalid!&#34;);
		NSArray *_permissions =  [[NSArray arrayWithObjects:
								   @&#34;publish_stream&#34;, @&#34;offline_access&#34;,nil] retain];
		[fb authorize:@&#34;your fb api code&#34; permissions:_permissions delegate:self];
		[self postFbMessage];
	}

	//[[CCDirector sharedDirector] replaceScene:[CoverScreen node]];
}
-(void)postFbMessage
{
	NSUserDefaults *save = [NSUserDefaults standardUserDefaults];

	SBJSON *jsonWriter = [[SBJSON new] autorelease];

	NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
														   @&#34;link tittle&#34;,@&#34;text&#34;,@&#34;http://google.com&#34;,@&#34;href&#34;, nil], nil];

	NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
	NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
								@&#34;message tittle&#34;, @&#34;name&#34;,
								@&#34; &#34;, @&#34;caption&#34;,
								@&#34; &#34;, @&#34;description&#34;,
								@&#34;http://bit.ly/aYDOkY&#34;, @&#34;href&#34;, nil];
	NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
	NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
								   @&#34;your app fb id&#34;, @&#34;api_key&#34;,
								   @&#34;Share on Facebook&#34;,  @&#34;user_message_prompt&#34;,
								   actionLinksStr, @&#34;action_links&#34;,
								   attachmentStr, @&#34;attachment&#34;,
								   nil];

	[fb dialog: @&#34;stream.publish&#34;
	 andParams: params
   andDelegate:self];
}
@end</code></pre>
<p>Regards.</p>
<p>Jorge
</p></description>
		</item>
		<item>
			<title>cocojoe on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-59975</link>
			<pubDate>Tue, 19 Oct 2010 21:42:16 +0000</pubDate>
			<dc:creator>cocojoe</dc:creator>
			<guid isPermaLink="false">59975@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Well I decided to look into adding a twitter / facebook highscore posting option today and came across this great thread.</p>
<p>Thought twitter would be easier, but the fail whale came up both times I tried to register the app so just gave it a miss.</p>
<p>So onto Facebook, the aim was to simply log in the user and present a publish dialog for score. (I'm not a fan of auto publishing stream write type apps)</p>
<p>Have got it all working on iPhone 3G OS3, however when I test on my iPhone 4 the keyboard is unavailable when the login dialog comes up, also noticed the loading whirler isn't visible.<br />
Anyone else have this issue? Annoying as works fine on 3G.
</p></description>
		</item>
		<item>
			<title>sarfie on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-53723</link>
			<pubDate>Sat, 04 Sep 2010 23:05:34 +0000</pubDate>
			<dc:creator>sarfie</dc:creator>
			<guid isPermaLink="false">53723@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,<br />
Can anyone help me understand as to why the login button disappears whenever a user logs in or presses cancel on the dialog?</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>ZebulonSwe on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-52445</link>
			<pubDate>Fri, 27 Aug 2010 09:10:15 +0000</pubDate>
			<dc:creator>ZebulonSwe</dc:creator>
			<guid isPermaLink="false">52445@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks for a great tutorial!</p>
<p>I got the string (NSString *attachment) right. But I don't see any pictures on the wall. I have a URL to my picture, that is sent with the string, but still no picture.</p>
<p>Do I need to fill in the fields in "Facebook Integration" in Facebook, to get the "http://apps.facebook.com/YOURAPP/"-string?</p>
<p>Thanks for any help! :)
</p></description>
		</item>
		<item>
			<title>ZebulonSwe on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-52328</link>
			<pubDate>Thu, 26 Aug 2010 14:34:15 +0000</pubDate>
			<dc:creator>ZebulonSwe</dc:creator>
			<guid isPermaLink="false">52328@http://www.cocos2d-iphone.org/forum/</guid>
			<description><blockquote><p>Hi all, i try to implemented the codes... but these lines are simply produce error because the "" and //</p>
<p>NSString *attachment = [NSString stringWithFormat:@"{\"media\": [{\"type\": \"image\", \"src\": \"%@\", \"href\": \"http://apps.facebook.com/YOURAPP/\", \"width\":\"200\",\"height\":\"200\" }]}", imgUrl];</p>
<p>[self postFaceBookStory:[NSString stringWithFormat:@"played a game that I gave permissions to post to my wall"]:[NSString stringWithFormat:@"http://www.someurl.com/some_image.jpg"]];</p>
<p>Help anyone?.... thanks in advance...</p></blockquote>
<p>I have the exact same problem... :(
</p></description>
		</item>
		<item>
			<title>hinata88 on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-41723</link>
			<pubDate>Tue, 15 Jun 2010 09:11:25 +0000</pubDate>
			<dc:creator>hinata88</dc:creator>
			<guid isPermaLink="false">41723@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all, i try to implemented the codes... but these lines are simply produce error because the "" and // </p>
<p>NSString *attachment = [NSString stringWithFormat:@"{\"media\": [{\"type\": \"image\", \"src\": \"<a>%@\</a>", \"href\": \"<a href="http://apps.facebook.com/YOURAPP//"><a href="http://apps.facebook.com/YOURAPP/" rel="nofollow">http://apps.facebook.com/YOURAPP/</a>\</a>", \"width\":\"200\",\"height\":\"200\" }]}", imgUrl];</p>
<p>[self postFaceBookStory:[NSString stringWithFormat:@"played a game that I gave permissions to post to my wall"]:[NSString stringWithFormat:@"<a href="http://www.someurl.com/some_image.jpg">http://www.someurl.com/some_image.jpg</a>"]];</p>
<p>Help anyone?.... thanks in advance...
</p></description>
		</item>
		<item>
			<title>Webtopia on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-31864</link>
			<pubDate>Sun, 28 Mar 2010 13:02:16 +0000</pubDate>
			<dc:creator>Webtopia</dc:creator>
			<guid isPermaLink="false">31864@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi Everyone,</p>
<p>OK I've got it working pretty good now.</p>
<p>Just a couple of questions about the FBStreamDialog.</p>
<p>I understand it doesn't have the full functionality on the iPhone as it does in facebook apps.</p>
<p>If I have the line<br />
<code>dialog.userMessagePrompt = @&#34;User Message&#34;;</code><br />
Can I prefill the message with something like "has scored 4 out of 20 playing" so the user can change the message if he/she likes but if they don't the first line appearing on their facebook wall would be.</p>
<p><code>John Smith has scored 4 out of 20 playing</code></p>
<p>Then in the next line I could<br />
<code>dialog.attachment = @&#34;{\&#34;name\&#34;:\&#34;iPhoneAppName - iPhone App\&#34;,\&#34;href\&#34;:\&#34;http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=XXXXXXXX&#38;mt=8\&#34;}</code></p>
<p>so it shows up as a link to the iphone app with the title of the app.</p>
<p>Alternatively if I can't prefill the messagePrompt is there some way to reference the facebook username with a variable.  So that I can create a "John Smith has scored..." style output in the dialog.attachment section or the wall post.</p>
<p>What other variables are there that I can use.  Is this the complete list? <a href="http://wiki.developers.facebook.com/index.php/Attachment_%28Streams%29" rel="nofollow">http://wiki.developers.facebook.com/index.php/Attachment_%28Streams%29</a></p>
<p>Thanks,<br />
Travis
</p></description>
		</item>
		<item>
			<title>Webtopia on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-31569</link>
			<pubDate>Fri, 26 Mar 2010 04:01:03 +0000</pubDate>
			<dc:creator>Webtopia</dc:creator>
			<guid isPermaLink="false">31569@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Sorry ignore that last post.  I was being an idiot.  I hadn't created the session so it wasn't working properly.</p>
<p>It needs to stay as <a href="http://www.facebook.com" rel="nofollow">http://www.facebook.com</a> or it will not work.
</p></description>
		</item>
		<item>
			<title>Webtopia on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-31560</link>
			<pubDate>Fri, 26 Mar 2010 02:10:34 +0000</pubDate>
			<dc:creator>Webtopia</dc:creator>
			<guid isPermaLink="false">31560@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Not sure if I'm doing things correctly but the facebook login page looks like a standard web-browser.  </p>
<p>I noticed in FBLoginDialog.m they direct you to </p>
<p>static NSString* kLoginURL = @"http://www.facebook.com/login.php";</p>
<p>I've changed mine to </p>
<p>static NSString* kLoginURL = @"http://touch.facebook.com/login.php";</p>
<p>Doesn't it make more sense?
</p></description>
		</item>
		<item>
			<title>Matt Rix on "My Tutorial: Using Facebook Connect w/ Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3392#post-31261</link>
			<pubDate>Wed, 24 Mar 2010 01:16:46 +0000</pubDate>
			<dc:creator>Matt Rix</dc:creator>
			<guid isPermaLink="false">31261@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Yep, you're totally right. Luckily some guy figured out how to get around Facebook's *intentional* bug (the one I was mentioning): <a href="http://j.mp/9aJbKJ" rel="nofollow">http://j.mp/9aJbKJ</a></p>
<p>Basically, Facebook doesn't want you to know whether the user was successful or not(!), because they're afraid you'll give them incentives for sharing things with their friends (ie. "you'll get 100xp if you share this with your friends"). I appreciate how they're trying to protect the user, but I *strongly* disagree with their way of doing it(especially since it's so easy to work around).
</p></description>
		</item>

	</channel>
</rss>

