BranchMetrics / unity-branch-deep-linking-attribution

The Branch Unity SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/apps/unity/
MIT License
118 stars 25 forks source link

iOS build fails unless UDM4U is manually installed #222

Open bdg-raini opened 1 month ago

bdg-raini commented 1 month ago

Describe the bug

When making an iOS build after adding the Branch Unity SDK, there is no .xcworkspace generated, only .xcodeproj. This means that the dependency to the Branch iOS SDK is not resolved, and the build fails due to missing headers.

After investigating I can see this particular problem was reported for 1.0.0. It sounds like an issue with EDM4U.

After some more digging I can see that EDM4U is no longer bundled with the .unitypackage. The release notes mention that it was removed in favour of using UPM (via OpenUPM) however their is no package manifest in the .unitypackage and so EDM4U is not installed automatically. Is the user meant to install EDM4U manually, or is the .unitypackage supposed to have a package manifest?

I can see the docs haven't been updated for over a year, and don't seem up-to-date with release 2.0.0. There's a section at the very bottom about installing EDM4U, but it's for a different issue.

Also EDM4U seems to use Cocoapods for iOS builds, which is not installed on MacOS by default. I'm not sure if EDM4U will install Cocoapods for the user, if not then it's probably important to mention in the docs. The Branch Unity page doesn't currently have any info concerning the build process and dependencies resolution, it has to be pieced together from the platform-specific pages.

Steps to reproduce

  1. Install BranchUnityPackage.unitypackage 2.0.0 into an existing project (that doesn't already have EDM4U installed) and follow the rest of the [instructions for the Unity SDK]
  2. Notice that EDM4U is not available (eg. no Assets/External Dependency Manager menu item)
  3. Build for iOS from Unity
  4. Notice that the output directory has a .xcodeproj but no .xcworkspace
  5. Open the .xcodeproj and attempt to build/archive
  6. Notice build errors from missing headers (eg. Branch.h)

Expected behavior

EDM4U should be installed automatically after importing BranchUnityPackage.unitypackage. After building for iOS from Unity Editor the output directory should contain a .xcworkspace with details of the Branch iOS SDK dependency. Building in XCode should succeed and not fail on missing header errors.

SDK Version

2.0.0

Unity Version

2021.3.38

Make and Model

Macbook Pro (M3 Pro)

OS

MacOS 14.6.1

Additional Information/Context

No response

bdg-raini commented 1 month ago

I manually installed EDM4U via UPM and it will indeed install Cocoapods for the user if it's not installed, I tested by uninstalling Cocoapods and reopening the editor.

After:

I can successfully observe a generated .xcworkspace which successfully builds.