XCode cannot find 'ReferenceImageLibrary' on ARKit

Hello,

I am working on developing an app on IOS with Unity. I use AR Foundation on Unity and ARKit on IOS, my issue is when I try to use the image targeting, specifically the “ReferenceImageLibrary” which XCode says that it cannot find, even though I double checked and it is there. I get the following error on XCode:

found
InvalidOperationException: Failed to set requested image library 'ReferenceImageLibrary' on 
ARKit - there is no matching resource group, or the resource group does not contain any
reference images.```

Here is how the reference library looks on XCode

![](https://firebasestorage.googleapis.com/v0/b/wemet-bffd3.appspot.com/o/cropped.png?alt=media&token=9f2d790b-bff0-4d61-83b3-49e0edba2fa5) 
Things I have tried:
- Make the path "Absolute Path" for the ImageLibrary
- Using only UnityFramework as my only target membership
- Using both as my target membership

Versions currently using:
- Xcode 11.3.1
- Unity 2019.3.5f1
- AR Foundation 2.1.4
- ARKit 2.1.1

Let me know if more detail is required. Thank you!

Please try updating to either

(1)

  • ARFoundation 2.2.0-preview.6
  • ARKit 2.2.0-preview.6

or

(2)

  • ARFoundation 3.0.1
  • ARKit 3.0.1

Ok I just tried

  • ARFoundation 3.0.1
  • ARKit 3.0.1
    and got the same error

On my version of Unity I do not see these version:

  • ARFoundation 2.2.0-preview.6
  • ARKit 2.2.0-preview.6

You have to enable “Show preview packages” in the “Advanced” drop-down menu in the Package Manager.

I found & install them, but we still facing the same issue even with:

  • ARFoundation 2.2.0-preview.6
  • ARKit 2.2.0-preview.6

Here is more details on what we get when we run the app, for now it is just a simple cube that loads when it sees the Unity logo. Also, I attached the code I am currently using. One more thing, a new folder was create when I build from this version, a folder called ARReferenceObjects.xcassets but it is empty. Could that affect?

Initializing Metal device caps: Apple A12 GPU

Initialize engine version: 2019.3.5f1 (d691e07d38ef)

2020-04-01 23:23:15.075593-0600 Runner[15136:5360558] Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x121804190>.

UnloadTime: 3.631375 ms

[Subsystems] Loading plugin UnityARKit for subsystem ARKit-Input…

[Subsystems] UnityARKit successfully registered Provider for ARKit-Input

2020-04-01 23:23:17.109686-0600 Runner[15136:5360558] [General] No resource group with name “ReferenceImageLibrary_E00EF92C-1199-3B49-9644-14CE2F93FAB1” found

InvalidOperationException: Failed to resolve image library ‘ReferenceImageLibrary’. There is no matching resource group, or the resource group does not contain any reference images.

at UnityEngine.XR.ARKit.ARKitImageDatabase…ctor (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0

at UnityEngine.XR.ARKit.ARKitImageTrackingSubsystem+Provider.CreateRuntimeLibrary (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0

at UnityEngine.XR.ARSubsystems.XRImageTrackingSubsystem.CreateRuntimeLibrary (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0

at UnityEngine.XR.ARFoundation.ARTrackedImageManager.OnBeforeStart () [0x00000] in <00000000000000000000000000000000>:0

at UnityEngine.XR.ARFoundation.SubsystemLifecycleManager`2[TSubsystem,TSubsystemDescriptor].OnEnable () [0x00000] in <00000000000000000000000000000000>:0

(Filename: currently not available on il2cpp Line: -1)

Here I also attached the script that I am using

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//import the libraries below
using UnityEngine.XR.ARSubsystems;
using UnityEngine.XR.ARFoundation;
public class TrackedImage : MonoBehaviour
{
    //create the “trackable” manager to detect 2D images
    ARTrackedImageManager m_TrackedImageManager;
    //call Awake method to initialize tracked image manager
    void Awake()
    {
        //initialized tracked image manager 
        m_TrackedImageManager = GetComponent<ARTrackedImageManager>();
    }
    //when the tracked image manager is enabled add binding to the tracked
    //image changed event handler by calling a method to iterate through
   //image reference’s changes
    void OnEnable()
    {
        m_TrackedImageManager.trackedImagesChanged += OnTrackedImagesChanged;
    }
   //when the tracked image manager is disabled remove binding to the
   //tracked image changed event handler by calling a method to iterate
   //through image reference’s changes
    void OnDisable()
    {
        m_TrackedImageManager.trackedImagesChanged -= OnTrackedImagesChanged;
    }
    //method to iterate tracked image changed event handler arguments
    void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)
    {
        // for each tracked image that has been added
        foreach (var trackedImage in eventArgs.added)
        {
            // Give the initial image a reasonable default scale
           trackedImage.transform.localScale = new Vector3(1f, 1f, 1f);
        }
       
        // for each tracked image that has been updated
        foreach (var trackedImage in eventArgs.updated)
           //throw tracked image to check tracking state
            UpdateGameObject(trackedImage);
        // for each tracked image that has been removed 
        foreach (var trackedImage in eventArgs.removed)
        {
            // destroy the AR object associated with the tracked image
            Destroy(trackedImage.gameObject);
        }
    }
    // method to update image tracked game object visibility
    void UpdateGameObject(ARTrackedImage trackedImage)
    {
        Debug.Log("Tracking State: " + trackedImage.trackingState);
        //if tracked image tracking state is comparable to tracking
        if (trackedImage.trackingState == TrackingState.Tracking)
        {
            //set the image tracked ar object to active
            trackedImage.gameObject.SetActive(true);
        }
        else //if tracked image tracking state is limited or none
        {
            //deactivate the image tracked ar object
            trackedImage.gameObject.SetActive(false);
        }
    }
}

@SushiRoll53 did you find fix ? Got same error, and almost same script.

8983471--1237162--Screenshot 2023-05-02 at 1.34.58 PM.png These are the import settings on the .jpg art. I deleted the reference library and then made a new one. A Unity error stated that Vuforia requires that in your Player Settings/Resolution and Presentation that you check Render Over Native UI. Once I did those two things, it found my Reference Image Library and recognized the .jpg art there. Only use .jpg

When you delete and make a new Reference Image Library, make sure your Game Object called AR Session Origin/ARTrackedImageMgr script/Serialized Library is pointing to your new Reference Image Library.

The clue is that during the build, the error shown is that the art is not recognized by the reference library.