Wizcorp / phonegap-facebook-plugin

The official plugin for Facebook in Apache Cordova/PhoneGap
Other
1.91k stars 2.01k forks source link

IOS login problem #875

Open batman11111 opened 9 years ago

batman11111 commented 9 years ago

Using IOS version 7.0 and the latest facebook app(downloaded today)

I first use facebookConnectPlugin.getLoginStatus() to check if the user is logged in. I get response.status == "unknown" (which is expected since the user isnt logged in at this time. The next thing I do is use facebookConnectPlugin.login(["public_profile"],success(alert("success")){}, fail(){}) To login and get the public profile permissions. The first time, the facebook app opens asks me to accept the permission and then goes back to my app and my app restarts (which it is not supposed to do). The second time, and there after, when I try to use facebookConnectPlugin.login(["public_profile"],success(alert("success")){}, fail(){}) to actually login in and get some profile data, the facebook app opens, tells me I've already accepted the permissions, sends me back to my app and my app restarts.

In either case the login function never fully completes. i.e. I never see the alert "success" above. I also have an alert setup in the failure callback and that doesn't execute either. My app just restarts.

Can you help me out?

FYI: The same code works perfectly on android 4.4.

batman11111 commented 9 years ago

I believe I have the problem narrowed down to either my config.xml file and/or the facebook developer site

Here is my config.xml file. Is there anything missing or incorrect here? How do I setup the FB dev site for IOS?

I have single sign on turned on. I've tried com.myApp.hello for the Bundle ID (but doesn't seem to work) deep linking is turned off and nothing listed in iphone/ipad store ID or url scheme suffix. I'm not sure what I'm missing. Any help would be appreciate.... thanks.

<?xml version="1.0" encoding="UTF-8"?>

<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns     = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id        = "com.myApp.hello"
        version   = "1.0.2">
<gap:config-file platform="ios" parent="CFBundleShortVersionString"><string>116</string></gap:config-file>

    <name>My App</name>

    <description>
        This is my app
    </description>

<gap:platform name="android" />
<gap:platform name="ios" /> 
    <preference name="permissions" value="none"/>
    <gap:plugin name="org.apache.cordova.dialogs" />
    <gap:plugin name="org.apache.cordova.vibration" version="0.3.0" />
    <gap:plugin name="nl.x-services.plugins.insomnia" version="3.0" />
    <gap:plugin name="com.phonegap.plugin.statusbar" version="1.1.0" />        
    <gap:plugin name="com.megster.cordova.rfduino" version="0.0.3" />
    <gap:plugin name="org.apache.cordova.media" />
    <gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.9.0">        
        <param name="APP_ID" value="15digit app number" />          
        <param name="APP_NAME" value="myAppLLC" />

    </gap:plugin>

    <gap:config-file platform="ios" parent="UIStatusBarHidden"><true/></gap:config-file>
    <gap:config-file platform="ios" parent="UIViewControllerBasedStatusBarAppearance"><false/></gap:config-file>      

    <preference name="webviewbounce" value="false" />          
    <preference name="orientation" value="portrait" />
    <preference name="exit-on-suspend"            value="true" />          
    <preference name="show-splash-screen-spinner" value="true" />           

    <gap:splash src="img/icon/ios/splash.png"   gap:platform="ios"        width="640" height="1136" />
    <icon src="img/icon/ios/icon-57.png"            gap:platform="ios"        width="57" height="57" />
    <icon src="img/icon/ios/icon-72.png"            gap:platform="ios"        width="72" height="72" />
    <icon src="img/icon/ios/icon-57-2x.png"         gap:platform="ios"        width="114" height="114" />
    <icon src="img/icon/ios/icon-72-2x.png"         gap:platform="ios"        width="144" height="144" />
    <icon src="img/icon/ios/icon-60.png"            gap:platform="ios"    width="60" height="60" />
    <icon src="img/icon/ios/icon-60@2x.png"     gap:platform="ios"    width="120" height="120" />

    <icon src="icon.png" />

    <gap:splash src="splash.png" />

        <access origin="*"/>

</widget>
bastiao commented 9 years ago

I have the similar problem. But in my case nothing happens. I put the code but it does not rise success or fail callback.

Any idea to help debugging?

batman11111 commented 9 years ago

I have no idea. It seems to work following the ios instructions but there is some kind of issue with phonegap build.

aogilvie commented 9 years ago

@batman11111 firstly have you read the Troubleshooting Guide? Most cases of no reply from login is linked to incorrect hash key. Have you set up your hash key correctly?

batman11111 commented 9 years ago

On android it works fine. I'm having the problem with iOS. I did get it to work using the Cordova CLI just not PG build. Any suggestions?

aogilvie commented 9 years ago

@batman11111 :( I'll leave this open for a bit more incase someone in the community (providing some kind of log output would be a good idea) has an answer but officially we've stopped supporting PGB - https://github.com/Wizcorp/phonegap-facebook-plugin/blob/develop/platforms/pg-build/README.md

airiarte commented 9 years ago

I've figured it out, the problem is with UIApplicationExitsOnSuspend set to true (). I've set it to false and everything worked fine now.

airiarte commented 9 years ago

@batman11111 change the preference exit-on-suspend to false.

sirwoetang commented 9 years ago

@airiarte Changing the preference exit-on-suspend to false like you said did not do the fix for me. I also implemented a fix to try and write to the plist file from within PGB using gap:config-file platform="ios" parent="UIApplicationExitsOnSuspend" overwrite="true" which also did not work. Would you mind pasting the rest of your config.xml for comaprison?

At the moment I am looping thorugh all avalable versions of facebook-connect plugin to get a version to work with PGB.

airiarte commented 9 years ago

@sirwoetang I´ve tried with XCODE, not PGB. Anyway, you should try overriding using gap:config-file platform="ios" parent="UIApplicationExitsOnSuspend" with false