Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iOS build with Unity 2019.3 and later #457

Closed
wants to merge 1 commit into from

Conversation

Nezz
Copy link

@Nezz Nezz commented Jul 24, 2020

Thanks for proposing a pull request!

To help us review the request, please complete the following:

  • sign contributor license agreement
  • I've ensured that all existing tests pass and added tests (when/where necessary)
  • I've updated the documentation (when/where necessary) and Changelog (when/where necessary)
  • I've added the proper label to this pull request (e.g. bug for bug fixes)

I don't have the permission to add labels.

Pull Request Details

The proposed fix only worked for older Unity versions. Resolves #450.

Test Plan

Build for iOS using various Unity versions

The proposed fix only worked for older Unity versions
// The UnityFramework target will include the code and Unity-iPhone is only a thin wrapper around it.
// With earlier versions everything is in a single Unity-iPhone target.
var targetName = GetUnityVersionNumber() >= 201930 ? "UnityFramework" : "Unity-iPhone";
string targetGUID = proj.TargetGuidByName(targetName);
Copy link

@Thaina Thaina Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this better?

#if UNITY_2019_3_OR_NEWER
		string targetGUID = proj.GetUnityFrameworkTargetGuid();
#else
		string targetName = PBXProject.GetUnityTargetName();
		string targetGUID = proj.TargetGuidByName(targetName);
#endif

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that won't work. We cannot use preprocessor directives here as this file is compiled into a DLL that has to support various Unity versions.

Copy link

@Thaina Thaina Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nezz I see but still didn't GetUnityFrameworkTargetGuid and GetUnityTargetName better than constant?

string targetGUID = GetUnityVersionNumber() >= 201930 ? proj.GetUnityFrameworkTargetGuid() : proj.TargetGuidByName(PBXProject.GetUnityTargetName());

Copy link
Author

@Nezz Nezz Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetUnityFrameworkTargetGuid is only available in Unity 2019.3 and later. If you include this DLL in a 2018.4 project, you will get a compiler error.

GetUnityTargetName was removed in Unity 2019.3. If you include this DLL in a 2019.3+ project, you will get a compiler error.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you for clarification

@Nezz Nezz closed this Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undefined symbol: swiftCompatibility
3 participants