Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.07k stars 1.15k forks source link

Can not Archive Xcode project #815

Closed dorkbot closed 3 years ago

dorkbot commented 3 years ago

Hi,

I have a project that has successfully archived in Xcode before, that last time was a couple of months ago. I tried to day and I get this error

"Cannot initialize a parameter of type 'id _Nonnull' with an rvalue of type 'Class'"

with these methods...

{
    UnityARSession* nativeSession = (__bridge UnityARSession*)session;
    UnityARAnchorCallbackWrapper* anchorCallbacks = [[UnityARAnchorCallbackWrapper alloc] init];
    anchorCallbacks->_anchorAddedCallback = anchorAddedCallback;
    anchorCallbacks->_anchorUpdatedCallback = anchorUpdatedCallback;
    anchorCallbacks->_anchorRemovedCallback = anchorRemovedCallback;
    [nativeSession->_classToCallbackMap setObject:anchorCallbacks forKey:[ARPlaneAnchor class]];
}

extern "C" void session_SetUserAnchorCallbacks(const void* session, UNITY_AR_USER_ANCHOR_CALLBACK userAnchorAddedCallback, 
                                            UNITY_AR_USER_ANCHOR_CALLBACK userAnchorUpdatedCallback, 
                                            UNITY_AR_USER_ANCHOR_CALLBACK userAnchorRemovedCallback)
{
    UnityARSession* nativeSession = (__bridge UnityARSession*)session;
    UnityARUserAnchorCallbackWrapper* userAnchorCallbacks = [[UnityARUserAnchorCallbackWrapper alloc] init];
    userAnchorCallbacks->_anchorAddedCallback = userAnchorAddedCallback;
    userAnchorCallbacks->_anchorUpdatedCallback = userAnchorUpdatedCallback;
    userAnchorCallbacks->_anchorRemovedCallback = userAnchorRemovedCallback;
    [nativeSession->_classToCallbackMap setObject:userAnchorCallbacks forKey:[ARAnchor class]];
}

I'm using Unity 2019.4.20 and ARFoundation 2.1.18

Does anyone have any advice?

tdmowrer commented 3 years ago

The code you've posted is not from AR Foundation. That looks like the deprecated "UnityARKit plugin" (a precursor to AR Foundation). AR Foundation is not compatible with this plugin; for AR Foundation iOS support, you will need the package called "ARKit XR Plugin". Are you sure you are using the code you posted? What happens if you remove it from your project?

dorkbot commented 3 years ago

ah okay. I updated Mapbox and I think it added ARKit and ARCore SDKs to my project. I'm removing them and trying a new build. Thank you.

dorkbot commented 3 years ago

Archive worked. Thanks!