cordova 3.3. facebook integration for iOS

Error:

2014 - 04 - 08 17: 38: 33.210 javacourseblog[10129: 907] ERROR: Plugin 'org.apache.cordova.facebook.Connect'
not found,
or is not a CDVPlugin.Check your plugin mapping in config.xml.
2014 - 04 - 08 17: 38: 33.211 javacourseblog[10129: 907] - [CDVCommandQueue executePending][Line 158] FAILED pluginJSON = ["org.apache.cordova.facebook.Connect1333284177", "org.apache.cordova.facebook.Connect", "login", ["email"]]

this my error;

i tried to Facebook login& logout using cordova

i followed this bellow blog page.

http://javacourseblog.blogspot.in/2014/01/facebook-login-logout-using-cordova-330.html

android facebook login is working fine. but iOS build it shows above error.i followed

Phonegap 3.0 IOS plugins not found

also its also not helping for me.. please any one can help...

Answers


step 1: create cordova project via telnet:

cordova create facebook in.com.fb Facebook

step 2: add facebook cordova plugin

cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git

step 3: remove and add fb id & app name .open the plugin.xml file from

  find and remove below 2 line

 after to add this 2 line 

step 4 add your platform for android or ios cordova platform add ios step 5 1.Now Make reference of cordova.js ,cdv-plugin-fb-connect.js and facebook-js-sdk.js in your www folder 2.remove your old code form index.html.add follwoing code find replace your fb app id in index.html '

<!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8" />
            <meta name="format-detection" content="telephone=no" />
            <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
            <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
            <link rel="stylesheet" type="text/css" href="css/index.css" />
            <title>Hello World</title>
        </head>
        <body>
            <div class="app">
                <h1>Apache Cordova</h1>
                <div id="deviceready" class="blink">
                    <p class="event listening">Connecting to Device</p>
                    <p class="event received">Device is Ready</p>
                </div>
            </div>
            <script type="text/javascript" src="cordova.js"></script>
            <script type="text/javascript" src="js/index.js"></script>
            <script type="text/javascript" charset="utf-8" src="cdv-plugin-fb-connect.js"></script>
            <script type="text/javascript" charset="utf-8" src="facebook_js_sdk.js"></script>


            <div id="data">Hello Facebooktesters, loading ...</div>

        <button onclick="login()">Login</button>
        <button onclick="me()">Me</button>

        <script type="text/javascript">
            document.addEventListener('deviceready', function() {
                try {
                    alert('Device is ready! Make sure you set your app_id below this alert.');
                    FB.init({
                        appId : "Your fb Id",
                        nativeInterface : CDV.FB,
                        useCachedDialogs : false
                    });
                    document.getElementById('data').innerHTML = "FB init executed";
                } catch (e) {
                    alert(e);
                }
            }, false);

            function me() {
                FB.api('/me/friends', {
                    fields : 'id, name, picture'
                }, function(response) {
                    if (response.error) {
                        alert(JSON.stringify(response.error));
                    } else {
                        var data = document.getElementById('data');
                        fdata = response.data;
                        console.log("fdata: " + fdata);
                        response.data.forEach(function(item) {
                            var d = document.createElement('div');
                            d.innerHTML = "<img src="+item.picture+"/>" + item.name;
                            data.appendChild(d);
                        });
                    }
                    var friends = response.data;
                    console.log(friends.length);
                    for ( var k = 0; k < friends.length && k < 200; k++) {
                        var friend = friends[k];
                        var index = 1;

                        friendIDs[k] = friend.id;
                        //friendsInfo[k] = friend;
                    }
                    console.log("friendId's: " + friendIDs);
                });
            }

            function login() {
                FB.login(function(response) {
                    if (response.authResponse) {
                        alert('logged in');
                    } else {
                        alert('not logged in');
                    }
                }, {
                    scope : "email"
                });
            }
        </script>
         <!-- <script type="text/javascript">
                app.initialize();
            </script> -->
        </body>
    </html>'

step 6: open your project in xcode and open ios plist file and add your fb appid and fb app_name step 7 go to your codova config.xml.find bellow this line exits or not..if not exits(ios) add to step..

<feature name="org.apache.cordova.facebook.Connect">
        <param name="ios-package" value="FacebookConnectPlugin" />
    </feature>

step 8

cordova build

step 9 again check plist file step 10 run your ios simulator


Make sure you install your facebook phonegap plugin in proper way. Don't use plugman.

cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin --variable APP_ID="xxxxxxxxxxxxxxx" --variable APP_NAME=“YourAppName”

Need Your Help

JPA: Store fileAttachment into the database

mysql jpa attachment playframework

I would like to know if there is any way I can store a fileAttachment directly into the database with JPA.

android: ViewPager with more than 100 webview

android android-viewpager viewpage

I've viewpager that has 604 webviews and i want to load 5 pages every time that user scrolling the pager, like that: