0

I have created an app through facebook developers and added an iOS platform and Android platform. iOS is now working with 3.2.2. Android however is not. My aim is to post a pre defined message onto a user's wall. My code is as follows. When I press my button fbShare(outlined below), I am getting a screen pop up with facebook at the top and a message stating:

App Not Setup: The developers of this app have not set up this app properly for facebook

I added the android platform in the apps settings page and copied the bundleID from my project. I also generated the key hash for both the location of my debug keystore and my actual production keystore. Neither have worked. My code for sharing is as follows:

var fbShare=Ti.UI.createImageView({
    image:'/images/fbShare.png',
    width:'36dp',
    height:'36dp',
    left:'5dp'
});

Navbar.add(fbShare);

fbShare.addEventListener("click", function (e){
    facebookLogin();
});


var fb;
var facebookLogin = function(){
     fb = require('facebook');
     fb.appid = 'xxxxxxxxxx';
    Ti.API.info('facebook logedin?' + fb.loggedIn);
    //login if not logged in
    if (!fb.loggedIn) {
        fb.permissions = ['publish_stream'];
        fb.forceDialogAuth = false;
        fb.authorize();
        fb.addEventListener('login', function(e) {
            if (e.success) {
                Ti.API.info("Facebook logged in - stage 1");  
                postToFacebook();

            } else if (e.error) {
                alert(e.error + " - stage 1");
            } else if (e.cancelled) {
                alert("Facebook login cancelled - stage 2");
            }
        });
    }else{
        postToFacebook();
    }
};


var data = {
            link : "www.mylink.com",
            name : "my name",
            message : "my message",
            caption : "my caption",
            picture : "myPic.jpg",
            description : "My description."
        };

var postToFacebook = function(){
    Ti.API.info("attempting to post to facebook...please wait");
    fb.requestWithGraphPath('me/feed', data,
    "POST", function(e) {
        if (e.success) {
            alert("Shared to facebook successfully!");
            fbShare.setEnabled(true);
        fbShare.setImage('/images/fbShare.png');
                Ti.API.info("Posted to facebook wall!");
        }else{
            if(e.error){
                Ti.API.info("cant post to facebook " + e.error);
            }else{
                Ti.API.info("something else happened...");
            }
            alert('Something went wrong with your post but facebook could not confirm what.');
            fbShare.setEnabled(true);
        fbShare.setImage('/images/fbShare.png');
        }
    });        
 };

I've been stuck on this for days, Any help or guidance appreciated

user2363025
  • 6,365
  • 19
  • 48
  • 89

1 Answers1

1

I had a similar issue yesterday. My code was correct but I still get that message. I fixed it by setting "Do you want to make this app and all its live features available to the general public?" to YES under "status and review" in Facebook developer website.

if you have done it already then please make sure your key Hashes are correct. Remember you need a debug key and release key.

if you have done the above steps and sure your key hashes are correct then there will be some other issue.

I hope this helps.

mnaa
  • 416
  • 4
  • 12
  • thank you so much. It has been driving me crazy. I am finally not receiving the 'not set up properly message', and i am getting to the screen where it says that the app is looking for permissions. However i am getting to else part of my post facebook function and the error in the log is: Request error for 'me/feed' call: (#200) The user hasn't authorized the application to perform this action. I thought fb.permissions = ['publish_stream']; would give my app the permission to post a status upsate? – user2363025 Jul 04 '14 at 11:23
  • Glad it helped you. have a look here hope you can relate. http://stackoverflow.com/questions/15796138/why-does-posting-to-facebook-page-yield-user-hasnt-authorized-the-application – mnaa Jul 04 '14 at 11:30
  • adding the 'status_update' permission did not help either...what permissions did you use? Or were you doing something other than a post relating to facebook – user2363025 Jul 04 '14 at 12:34
  • I was using Scringo's SDK so I didn't write any code for Facebook. I wish I could help you with your next issue. Good luck – mnaa Jul 04 '14 at 16:01