<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GoGo-Robot &#187; Facebook Connect</title>
	<atom:link href="http://www.gogo-robot.com/tag/facebook-connect/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gogo-robot.com</link>
	<description>Independent Games Developer</description>
	<lastBuildDate>Thu, 22 Jul 2010 13:14:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Facebook Connect Dialog on iPhone</title>
		<link>http://www.gogo-robot.com/2010/01/10/facebook-connect-dialog-on-iphone/</link>
		<comments>http://www.gogo-robot.com/2010/01/10/facebook-connect-dialog-on-iphone/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 15:03:14 +0000</pubDate>
		<dc:creator>Rew</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[Facebook Connect]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://www.gogo-robot.com/?p=75</guid>
		<description><![CDATA[A problem I keep having when adding Facebook Connect to iPhone applications is that sometimes the dialogs appear briefly then disappear. I keep forgetting why it is for a while, so I thought I&#8217;d post this to help anyone who is having a similar problem, and to remind myself about it so that maybe next [...]]]></description>
			<content:encoded><![CDATA[<p>A problem I keep having when adding Facebook Connect to iPhone applications is that sometimes the dialogs appear briefly then disappear. I keep forgetting why it is for a while, so I thought I&#8217;d post this to help anyone who is having a similar problem, and to remind myself about it so that maybe next time I won&#8217;t forget <img src='http://www.gogo-robot.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span id="more-75"></span></p>
<p>Anyway, the problem is in the FBDialog.m file. There are a couple of lines that read:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">UIWindow<span style="color: #002200;">*</span> window <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.keyWindow;
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>window<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    window <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.windows objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>The problem comes when you try and show the Facebook dialog just after something other than the main window is the key window. This could happen if you&#8217;ve popped up a UIAlertView to ask if the user wants to publish to Facebook. The UIAlertView is the application&#8217;s key window and when you display your Facebook dialog, it adds itself as a subview of the UIAlertView (which is currently closing). So, your dialog will start to display, then when the UIAlertView finishes closing, it&#8217;ll disappear. The easy fix is to just change the FBDialog.m file so that it always uses the second line, and doesn&#8217;t try to use the keyWindow property:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">UIWindow<span style="color: #002200;">*</span> window <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.windows objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.gogo-robot.com/2010/01/10/facebook-connect-dialog-on-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
