Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by jerryberry · Jul 30, 2014 at 11:39 AM · facebookposting

Facebook SDK: FB.Feed not posting

Hi! I finished my game. Now I want to make it social. Posting to twitter is easy, but I have problem with facebook.

I created an app on facebook dev, I have key-hash, key-store, I don't have any errors in console. I made enviroment variables with paths to JDK and OpenSSL.

I think that there's something wrong with my code (it's from SDK example) but I don't know what.

 using UnityEngine;
 using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 
 public sealed class FacebookShare : MonoBehaviour {
     #region FB.Init() example
     
     private bool isInit = false;
     
     void Awake ()
     {
         CallFBInit();
     }
 
     private void CallFBInit()
     {
         FB.Init(OnInitComplete, OnHideUnity);
     }
     
     private void OnInitComplete()
     {
         Debug.Log("FB.Init completed: Is user logged in? " + FB.IsLoggedIn);
         isInit = true;
     }
     
     private void OnHideUnity(bool isGameShown)
     {
         Debug.Log("Is game showing? " + isGameShown);
     }
     
     #endregion
     
     #region FB.Login() example
     
     private void CallFBLogin()
     {
         FB.Login("email,publish_actions", LoginCallback);
     }
     
     void LoginCallback(FBResult result)
     {
         if (result.Error != null)
             lastResponse = "Error Response:\n" + result.Error;
         else if (!FB.IsLoggedIn)
         {
             lastResponse = "Login cancelled by Player";
         }
         else
         {
             lastResponse = "Login was successful!";
         }
     }
     
     private void CallFBLogout()
     {
         FB.Logout();
     }
     #endregion
 
     #region FB.Feed() example
     
     public string FeedToId = "";
     public string FeedLink = "";
     public string FeedLinkName = "";
     public string FeedLinkCaption = "";
     public string FeedLinkDescription = "";
     public string FeedPicture = "";
     public string FeedMediaSource = "";
     public string FeedActionName = "";
     public string FeedActionLink = "";
     public string FeedReference = "";
     public bool IncludeFeedProperties = false;
     private Dictionary<string, string[]> FeedProperties = new Dictionary<string, string[]>();
     
     private void CallFBFeed()
     {
         Dictionary<string, string[]> feedProperties = null;
         if (IncludeFeedProperties)
         {
             feedProperties = FeedProperties;
         }
         FB.Feed(
             toId: FeedToId,
             link: FeedLink,
             linkName: FeedLinkName,
             linkCaption: FeedLinkCaption,
             linkDescription: FeedLinkDescription,
             picture: FeedPicture,
             mediaSource: FeedMediaSource,
             actionName: FeedActionName,
             actionLink: FeedActionLink,
             reference: FeedReference,
             properties: feedProperties,
             callback: Callback
             );
     }
     
     #endregion
     public string ApiQuery = "";
     private string lastResponse = "";
     private Texture2D lastResponseTexture;
 
     void Callback(FBResult result)
     {
         lastResponseTexture = null;
         // Some platforms return the empty string instead of null.
         if (!String.IsNullOrEmpty(result.Error))
             lastResponse = "Error Response:\n" + result.Error;
         else if (!ApiQuery.Contains("/picture"))
             lastResponse = "Success Response:\n" + result.Text;
         else
         {
             lastResponseTexture = result.Texture;
             lastResponse = "Success Response:\n";
         }
     }
 
     void OnClick ()
     {
         CallFBLogin();
         CallFBFeed();
     }
 }
 


This script is attached to NGUI button. In editor it works but on device it only asks to login and permision. Then nothing happens.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image palash_bhowmick1 · Aug 12, 2014 at 09:27 AM 0
Share

$$anonymous$$eyHash in Fb settings is the same key of Debug_Android_$$anonymous$$ey_Hash? If yes, then fb.feed should not work...

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Kiwasi · Aug 12, 2014 at 10:43 AM

Often Facebook code problems are on the Facebook side. Do you have publish_actions on the token you are using? Try run the token though the Facebook debugger. If the token does not have the request actions then you can get a more permissive one using the open graph explorer.

For other people to use publish_actions you must have completed facebooks submission and review process.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by darkmwar · Aug 15, 2014 at 04:58 PM

publish_actions gave me errors when I logcat in adb. try basic_info as permission.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Fb.Feed() not working in android when facebook app is installed 0 Answers

Can't build for Android 0 Answers

How do I correctly install the Facebook SDK plugin? 1 Answer

Facebook SDK Multi-friend-selector 1 Answer

Posting on Facebook from Facebook's application for IOS. How? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges