2

我正在使用 $cordovaFacebook 插件(http://ngcordova.com/docs/#Facebook),我的问题是:如何在会话中保持 FB 登录?奇怪的是,网页版可以运行,但 iOS 版不行。我的代码:

(controllers.js)

    angular.module('starter.controllers', [])

.controller('HomeCtrl', ['$scope', '$cordovaFacebook', '$state', function($scope, $cordovaFacebook, $state) {   
    $scope.FacebookLoginBtn = function() {
        $cordovaFacebook.login(["public_profile", "email", "user_friends", "user_relationship_details", "user_photos"])
        .then(function(success) {  
            $state.go('perfil');
        }, function (error) {
          // error
          console.log(error);
        });
    };
}])

.controller('PerfilCtrl', ['$scope', '$cordovaFacebook', function ($scope, $cordovaFacebook) {
    $cordovaFacebook.api("me/picture?redirect=false&type=large", ["public_profile"])
    .then(function (success) {
        $scope.foto = success.data;
        // console.log(success.data);
    }, function (error) {
        console.log(error);
    });

    $cordovaFacebook.api("me", ["public_profile"])
    .then(function(success) {
        $scope.me = success;
        // console.log(success);
    }, function (error) {
        console.log(error);
    });
}])

谢谢!离子论坛链接:http: //forum.ionicframework.com/t/cordova-facebook-plugin/13569/1

4

0 回答 0