adjust / unity_sdk

This is the Unity SDK of
http://www.adjust.com
MIT License
155 stars 71 forks source link

Error: namespace name 'iOS' does not exist in the namespace 'UnityEditor' #317

Closed IvanCerezo closed 1 month ago

IvanCerezo commented 1 month ago

[!CAUTION] Library\PackageCache\com.adjust.sdk@a5009aac5c\Scripts\Editor\AdjustEditor.cs(14,19): error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

There is an error related to the compiler conditions wrapping: https://github.com/adjust/unity_sdk/blob/a5009aac5c90f20c7f374c937f20539b11794dac/Assets/Adjust/Scripts/Editor/AdjustEditor.cs#L14

Current code is:

#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
#if UNITY_2019_3_OR_NEWER
using UnityEditor.iOS.Xcode.Extensions;
#endif

And it looks like it should be:

#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
#if UNITY_IOS && UNITY_2019_3_OR_NEWER
using UnityEditor.iOS.Xcode.Extensions;
#endif

Or:

#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#if UNITY_2019_3_OR_NEWER
using UnityEditor.iOS.Xcode.Extensions;
#endif
#endif
IvanCerezo commented 1 month ago

The repro rate is not 100%. Some machines trigger it always and some others never. I can not say under which conditions it happens.

uerceg commented 1 month ago

Hey @IvanCerezo,

Thank you for reporting this and for a detailed explanation. What is the Unity IDE version you're using when you face this error?

IvanCerezo commented 1 month ago

Thank you for your reply Version is 2022.3.47f1.

New info: Apparently the error might be triggered only if iOS Build Support Unity module is not installed in the machine. We could try to temporary work around it that way if confirmed but I guess the code should not be forcing us to do so.

uerceg commented 1 month ago

Ah, nice, thanks for the additional info, it helps.

In case this is something you can check quickly, I'd be curious if you can try the quick fork which I made with the changes you suggested (https://github.com/uerceg/unity_sdk/tree/upm_example). It's pretty much current state of latest Unity SDK version + your suggested change. Trying this out would be adding UPM package via https://github.com/uerceg/unity_sdk.git?path=Assets/Adjust#upm_example.

In case you can check whether this solves your issue, that'd be great and we can include this in the upcoming release.

IvanCerezo commented 1 month ago

Checked and working fine! 👍 Thanks for your help! Can you please ping me when it is merged into the main repo so I can set the actual link to it :D

uerceg commented 1 month ago

Great news, thanks for checking! It should be live soon, I'll keep you posted.

uerceg commented 1 month ago

It's live.

Thank you for all your help on this one!

I will close this ticket now, but in case you stumble upon some issues with the official 5.0.5 release, feel free to comment / reopen.

Cheers!