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
2
Question by jsr2k1 · Nov 14, 2014 at 10:54 AM · facebook

Facebook SDK - Send lives between users - FB.API() problem

Hello everyone,

I want to send lives between players. I'm trying to get the object ID with FB.API but I can't.

This is my code:

 Dictionary<string, string> formData = new Dictionary<string, string>();

 formData["og:url"] = "http://samples.ogp.me/746045498766635";
 formData["og:title"] = "Sample Life";
 formData["og:type"] = "bubbleparadisetwo:life";
 formData["og:image"] = "https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png";
 formData["og:description"] = "";
 formData["fb:app_id"] = "730922200278965";

 FB.API("/app/objects/bubbleparadisetwo:life", HttpMethod.POST, SendLiveCallback, formData);

And the result is:

"java.io.FileNotFoundException: https://graph.facebook.com/app/objects/bubbleparadisetwo:life"

Can you help me? Thanks in advance,

Joel

Comment
Add comment · Show 3
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 jsr2k1 · Nov 14, 2014 at 11:07 AM 0
Share

$$anonymous$$ore information: - The object type "Life" has been created in the Open Graph page. - The login to Facebook is: FB.Login("public_profile,email,user_friends,publish_actions", AuthCallback);

avatar image Kiwasi · Nov 14, 2014 at 11:12 AM 0
Share

I would suggest that you use a separate server to manage this. Facebook discourages using its open graph for anything other then social functions.

avatar image jsr2k1 · Nov 14, 2014 at 11:18 AM 0
Share

Sending objects between users is a typical option in games with facebook integration and I think it's a social function. Am I wrong?

2 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by jsr2k1 · Nov 14, 2014 at 03:46 PM

Solved!

 Dictionary formData = new Dictionary();
 formData["og:title"] = "Sample Life";
 formData["og:type"] = "bubbleparadisetwo:life";
 formData["fb:app_id"] = "730922200278965";   
 Dictionary formDic = new Dictionary();
 formDic["object"] = Facebook.MiniJSON.Json.Serialize(formData);
 FB.API("me/objects/bubbleparadisetwo:life", HttpMethod.POST, SendLiveCallback, formDic);


The question now is how to ask for lives???

I can use FB.AppRequest with OGActionType.AskFor ... but what ObjectId then if it's not yet created?

Comment
Add comment · Show 6 · 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 yashpal · Mar 16, 2015 at 10:48 AM 0
Share

hello @jsr2k1,

I am just using your code to generate object in facebook. but i don't get any success.

 Dictionary<string,string> formData = new Dictionary<string,string>();
         formData["og:title"] = "mazetest"; // I think any name is possible 
         formData["og:type"] = "gamemazerace:maze"; // og:type
         formData["fb:app_id"] = "192399180931956"; // app id.
 //        Dictionary formDic = new Dictionary(); // Your code but i got error.
         Dictionary<string,string> formDic = new Dictionary<string,string>();
         formDic["object"] = Facebook.$$anonymous$$iniJSON.Json.Serialize(formData); // I don't know what is fromDic["object"]?
         print ("formDic : " + formDic.Values);
         FB.API("me/objects/gamemazerace:maze", Http$$anonymous$$ethod.POST, SendLiveCallback, formDic);


I don't get any error. but new object is not created in object browser

I have few questions.

Where you get object ID?

and what is fromDic["object"]?

avatar image jsr2k1 · Mar 17, 2015 at 09:40 AM 2
Share

Finally, I did this:

  1. Create an object "Life" instance directly in the Object Browser (facebook developer dashboard).

  2. Copy the objectID and use it in my code.

  3. Always use the same objectID to send lives between users.

  4. Asf for one life with:

    FB.AppRequest("Ask for one life",OGActionType.AskFor, objectId, FriendSelectorFiltersArr, excludeIds,maxRecipients, FriendSelectorData,FriendSelectorTitle, callback : CallbackAskForOneLife );

  5. Send one life with:

    FB.AppRequest("Send one life", OGActionType.Send, objectId, new string[]{user}, FriendSelectorData, FriendSelectorTitle, callback : Callback );

  6. Delete all requests with:

    FB.API("v2.2/"+requestID, Http$$anonymous$$ethod.$$anonymous$$ETE, Callback);

avatar image yashpal · Mar 17, 2015 at 12:14 PM 0
Share

Thank you, @jsr2k1,

I will try that. I want to send some different data to other player. i think it can't possible with only one object.

I make progress on this question. I will update once it done correctly.

and i have one more question. may i want to delete object same as request?

avatar image jsr2k1 · Mar 18, 2015 at 10:12 AM 0
Share

I don't delete the object because I use it every time to send lives.

avatar image kashif789us · May 05, 2015 at 05:14 PM 0
Share

@jsr2k1, thank you for your steps, they really helped alot. I am facing one problem, if you can help me, I will be very grateful. How to accept the app request when I tap the notification?

Show more comments
avatar image
0

Answer by Saddamjit_Singh · Jun 19, 2017 at 09:43 AM

Hi, where i can find Open Graph page on my developer account? @js2k1

Comment
Add comment · Show 3 · 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 Saddamjit_Singh · Jun 20, 2017 at 05:36 AM 1
Share

want to implement send and ask gift feature in unity using facebook. Till now i have created an object in object browser and using this code after that -

  public void Object$$anonymous$$anagement()
      {
          Dictionary<string,string> formData = new Dictionary<string,string>();
          formData["og:title"] = "Shots";
          formData["og:type"] = "Object";
          formData["fb:app_id"] = "921871194580745";   
          Dictionary<string,string> formDic = new Dictionary<string,string>();
          formDic["object"] = Facebook.$$anonymous$$iniJSON.Json.Serialize(formData);
          Debug.LogError ("formDic : " + formDic.Values);
  
          FB.API("me/objects/Shots", Http$$anonymous$$ethod.POST, CreateFBLifeCallback, formDic);
      }
      public void CreateFBLifeCallback(IGraphResult result)
      {
          if (!string.IsNullOrEmpty(result.Error))
          {
              Debug.LogError("Error during object create call! " + result.Error);
          }
          else if (FB.IsLoggedIn)
          {
              Debug.LogError("ok during object create call! " + result.Error);
  
          }
      }
 

Nothing is working and i am also trying to send gift by using this code -

 {
          //string objectId = "464873603864100";
          string objectId = FBData.userid;
          FB.AppRequest (
              "Free Coins",
              OGActionType.SEND, // Can be .Send or .AskFor depending on what you want to do with the object.
              objectId, // Here we put the object id we got as a result before.                    
              SendGiftRecipient, // The id of the sender.
              "this is just testing data", // Here you can put in any data you want
              "Send coins to your friend", // A title
              AppSendGiftCallback
          );
      }

avatar image Saddamjit_Singh · Jun 20, 2017 at 09:10 AM 2
Share

i am getting

Object type 'Object' for ID '464873603864100' is not owned by this app

issue . pls hlp to resolve

avatar image zero_null Saddamjit_Singh · Nov 22, 2017 at 03:37 PM 0
Share

yes, because open graph objects are deprecated now.

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

30 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

FB.Feed() "properties" argument not working as expected 0 Answers

How to share high score(string)/game result data on facebook ...please any one help me ....:(. 2 Answers

Game crashing after sharing post on facebook 0 Answers

Facebook sdk cancelled login crash 3 Answers

Facebook API returning always empty data 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