Core Haptics Unity Errors In Xcode

I am trying to get the Apple Core Haptics plug-in to work with Unity but am having issues when I try to build the project.

I created a completely blank project with just the Core and CoreHaptics plug-ins installed. I then put in a single script (below) which is a replication of the script shared in the WWDC22 video on this subject.

Then when I try to build and run that project I get a series of “Undefined symbol:” errors in Xcode. These effect the CoreHaptics, UIFeedbackGenerator frameworks.

If I remove the script and just build an empty project with Core and CoreHaptics installed the build runs successfully. What am I doing wrong or missing that is causing these errors?

using Apple.CoreHaptics;

using System.Collections;

using UnityEngine;

public class Haptics : MonoBehaviour
{
    private CHHapticEngine _hapticEngine;
    private CHHapticPatternPlayer _hapticPlayer;
    [SerializeField] private AHAPAsset _hapticAsset;

    private void PrepareHaptics()
    {
        _hapticEngine = new CHHapticEngine();
        _hapticEngine.Start();
        _hapticPlayer = _hapticEngine.MakePlayer(_hapticAsset.GetPattern());
    }
    private void Play()
    {
    _hapticPlayer.Start();
}

}

FIXED - The issue was with an incorrect addition of the Apple Core and Core Haptic frameworks in Xcode. I re-did those and the errors went away.

Hi, I'm running into the same issue and having trouble following your solution. Could you share more on what fixed this for you? Did you have to add the Core Haptics framework under the "Link Binary with Libraries" section for the "UnityFramework" target (see attached)? I tried this but am still getting the errors. Thanks!

I had the same problems. Seems like the post process build scripts don't work correctly anymore. So you have to add all frameworks manually in the XCode project. For Apple.Core and Apple.CoreHaptics this means not just adding the iOS SDKs CoreHaptic.framework, but also the Unity Plugins wrapper .frameworks. E.g. "AppleCoreNative.framework" and "CoreHapticsWrapper.framework". See attached screenshots.

Core Haptics Unity Errors In Xcode
 
 
Q