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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by noahdyer · Dec 11, 2014 at 10:29 PM · facebook

Facebook SDK: Could not get data from access token: Object reference not set to an instance of an object

I'm sharing something that happened to me in hopes that it saves someone else a lot of time.

I'd been able to call FB.Init() and FB.Login() successfully in my app for many days. All of the sudden I was getting an app stopping error:

Could not get data from access token: Object reference not set to an instance of an object.

I knew the access token is correct. I was able to log it and assign it another variable prior to the error.

I hadn't changed anything that seems even remotely related.

Answer below!

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by noahdyer · Dec 11, 2014 at 10:41 PM

Doh! Looks like you can't answer your own questions like on Stack Overflow:

Anyhow, it turns out that this error was triggered by something TOTALLY unrelated. I had the following code after FB.Login() had returned.

 AllViewManagerScript.SnapToViewByName("FindFriendViewManager");

The AllViewManagerScriptClass had the following public property and function:

 public List<GameObject> viewManagers;

 
     //move the camera to a view 
     public static void SnapToViewByName(string viewName) {
 
         foreach (GameObject viewManager in viewManagers){
 
             if (viewManager.name == viewName){
 
                 //Camera.main.transform.position = new Vector3(viewManager.transform.position.x, Camera.main.transform.position.y, Camera.main.transform.position.z);
 
             }
         }
 
     }

I had assigned my view managers via the editor. But then I changed the viewManagers variable to static so that I could access it in my static method. It turns out that this removed the relationships I had previously defined in the editor.

For some reason, the foreach loop would execute once (instead of not at all like you might predict given an empty List), and then created an error when trying to execute the if comparison.

All the above makes reasonable sense as to why it would create an error, but I'm not sure why it would cause the FB SDK to spit out an error that is in fact factually related.

Point is, if you're getting the above error, you may have nothing wrong with your FB specific code.

Comment
Add comment · Show 1 · 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 clinto · Nov 05, 2015 at 07:44 PM 0
Share

Thank you! $$anonymous$$y bug was completely obvious once I STOPPED LOO$$anonymous$$ING IN FACEBOO$$anonymous$$!

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

"Facebook object not loaded yet" error 3 Answers

Can't submit facebook app for review 1 Answer

Facebook SDK web player FB.init problem 2 Answers

Facebook SDK restarts app 1 Answer

Rewarding Facebook requests 0 Answers


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