Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Xcode NullReferenceException ERROR but ONLY on iPad, not on iPhone

Discussion in 'Scripting' started by cratica, May 29, 2022.

  1. cratica

    cratica

    Joined:
    Dec 11, 2016
    Posts:
    55
    I've been developing a game for iphone and ipad. 95% of the test on iphone but every once in a while I will test on ipad as well. It's worked fine on ipad until now. The current version of game builds and runs fine on iphone but I get an error (and freeze) when trying to build and run on ipad. I do not know how to find out where this null ref exception is originated so I am reaching out for help.

    ERROR:
    NullReferenceException: Object reference not set to an instance of an object.

    It *seems* to be something to do with Facebook SDK since that is the area code it was at most recently as the log indicates..

    in testFBfetch set FBloggedIN = true
    now assigning aToken = facebook.unity.accesstoken.currentaccesstoken next
    after assigning aToken = facebook.unity.accesstoken.currentaccesstoken next
    NullReferenceException: Object reference not set to an instance of an object.

    If I click the yellow caution icon and look at the last reported item in Xcode it shows this... (not positive this is related but perhaps?)

    FBSDKURL *parsedUrl = [FBSDKURL URLWithInboundURL:url sourceApplication:nil]; (THEN ERROR... NULL PASSED TO A CALLEE THAT REQUIRES A NON NULL ARGUMENT

    (screenshot attached)

    Any help would be appreciated!
     

    Attached Files:

  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    If you're using the Facebook SDK, you'll need to make sure that you get a proper access token for your game from Facebook. Are you actually using Facebook for your game?
     
  3. cratica

    cratica

    Joined:
    Dec 11, 2016
    Posts:
    55
    Yes, using Facebook SDK to get user ID and for sharing, etc. This all works on iPhone... I can log in as FB user, etc. On iPad it hangs at launch with that NullReferenceException
     
  4. cratica

    cratica

    Joined:
    Dec 11, 2016
    Posts:
    55
    Actually it is also giving that error on my wife's iphone. My iphone is working fine. So not ipad/iphone related but something else. How do I trace back where the nullreferenceexception is coming from?
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,717
    If you sign into any social media apps (I forget the list) on Apple, you MUST also implement "Sign In With Apple"

    Docs here:

    https://developer.apple.com/sign-in-with-apple/get-started/

    Specifically:

    signin.png

    Not sure this is the technical reason it is failing, but perhaps Apple has begun to roll out a technical crosscheck.