Unity IOS SDK 11 Facebook SDK Crashes with error upon starting application

Checklist

Environment

enter image description here

Trying to get working ios build for iphone/ipad with working facebook sdk, mainly for install tracking.

Build is successfully built and installed. However this error occurs and build crashes/black screens.

2021-06-21 18:24:13.793878+0300 FishWave[908:235948] +[NSDate al_timeIntervalNow]: unrecognized selector sent to class 0x1fc9ea2b0
2021-06-21 18:24:13.795191+0300 FishWave[908:235948] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSDate al_timeIntervalNow]: unrecognized selector sent to class 0x1fc9ea2b0'
*** First throw call stack:
(0x19a4be754 0x1aef857a8 0x19a3c676c 0x19a4c12ac 0x19a4c35b0 0x106262ae4 0x1aef6e660 0x102ffe480 0x103011a70 0x10300f960 0x10300fa2c 0x10300286c 0x10300af70 0x19a0f2f60 0x19a411d00 0x19a3e0ae8 0x19b752930 0x102f2fd38 0x102f2fde0 0x19a0edcf8)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSDate al_timeIntervalNow]: unrecognized selector sent to class 0x1fc9ea2b0'
terminating with uncaught exception of type NSException
(lldb)

Steps to Reproduce

  1. Build project from Unity.
  2. Open in XCODE , sign profile.
  3. Build directly to iphone 12 by usb cable.

Code Sample

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Facebook.Unity;

public class FacebookService : MonoBehaviour, IMonoService
{
    void Awake()
    {
        if (!FB.IsInitialized)
        {
            // Initialize the Facebook SDK
            FB.Init(InitCallback, OnHideUnity);
        }
        else
        {
            // Already initialized, signal an app activation App Event
            FB.ActivateApp();
        }
    }

    private void InitCallback()
    {
        if (FB.IsInitialized)
        {
            // Signal an app activation App Event
            FB.ActivateApp();

            // Continue with Facebook SDK
            // ...
        }
        else
            Debug.Log("Failed to Initialize the Facebook SDK");
    }

    private void OnHideUnity(bool isGameShown)
    {
        //Time.timeScale = !isGameShown ? 0 : 1;
    }
}

Upvotes: 1

Views: 1667

Answers (1)

Thomas Elliot
Thomas Elliot

Reputation: 669

Please update to the External Dependency Manager to minimum version 1.2.164.

Open the iOS Resolver Settings (Assets > External Dependency Manager > iOS Resolver > Settings) and make sure you uncheck Add use_frameworks! to Podfile and Always add the main target to Podfile as in the attached screenshot.

Alternatively, update the Podfile manually as in the Context section above then run pod install --repo-update to make sure the Podfile changes are applied to the project.

Note: The Facebook SDK Unity Plugin adds use_frameworks! to the Podfile here so this line may need to be removed to avoid manually removing it every time.

enter image description here

Upvotes: 1

Related Questions