Facebook Login Problem "Safari can not open the page because the address is invalid"

You must Login before you can answer or comment on any questions.

After I click on the "Login With Facebook" button in my app, it takes me to safari and asks me to authorize the app. I click "Allow" and instead of returning me to my app it shows an alert box saying...

"Cannot Open Page Safari can not open the page because the address is invalid"

I am guessing this is not an issue with my iPhone app but a configuration problem with the Facebook App Settings. If I am correct, does anyone know how to correctly configure a Facebook App to send you back to the iPhone app after authorization? Thanks!

4 Answers

No, this is a problem with your iPhone App. Try going to the "build/iphone" directory of your app and deleting all the contents, then re-building the app from Titanium Developer.

And make sure that in your tiapp.xml file you have this line:

<property name="ti.facebook.appid">193045187382315</property>
That's the line that tells Facebook to launch your app after you press "Allow". Without a full restart this property doesn't get accounted for and that error occurs.

— answered 2 years ago by Colton Arabsky
answer permalink
2 Comments
  • Where does it go in the tiapp.xml?

    — commented 2 years ago by Jeremy Fox

  • I added it right after the <copyright...> line and that didn't work. And yes, I changed the appid to my own Facebook appid.

    — commented 2 years ago by Jeremy Fox

I had the same problem. Aside from adding appid in the app itself and in tiapp.xml I had to manually delete the build folder and then re-launch the app.

I had the same issue and besides adding fbXXXXXXXXXXX appid string to the Info.plist, I needed to switch build targets in xcode: i.e. tell xcode to build for the Simulator target and when building for Device afterwards, it worked. I assume the build was messed up...

I did exactly what the below told me to:

http://developer.appcelerator.com/blog/2011/02/facebook-module-changes-in-titanium-mobile-1-6-0.html

Specifically, like what Colton mentioned:

*

  If you use tiapp.xml:
      o Add in the following property:
        &lt;property name=&quot;ti.facebook.appid&quot;&gt;[YOUR FB APP ID GOES HERE]&lt;/property&gt;
      o Clean and rebuild your app
      o Note that this property is ONLY to tell the Facebook authentication process
        how to restart your app: It does not tell the Titanium framework what your
        app ID is. You will still need to set the Titanium.Facebook.appid property.
*

  If you use Info.plist:
      o You’ll need to edit the CFBundleURLSchemes array to include the URL that
        Facebook uses to restart your app after login is completed:

              &lt;key&gt;CFBundleURLSchemes&lt;/key&gt;
              &lt;array&gt;
                      ... OTHER URL SCHEMES HERE ...
                      &lt;string&gt;fb[YOUR FB APP ID GOES HERE]&lt;/string&gt;
              &lt;/array&gt;

        Note the ‘fb’ prefix that goes before your Facebook app ID.

BUT... it still jumps out of my app and after I authorised the FB, it restarts my iphone app and the process goes into an endless cycle...

What is my missing link?

Your Answer

Think you can help? Login to answer this question!