ms-intune-app-sdk-ios
ms-intune-app-sdk-ios copied to clipboard
Incorrect dylib load path for IntuneMAMTelemetry framework
Describe the bug:
An app built with IntuneMAMTelemetry may crash at launch due to an incorrect load path. The path appears to be what one would expect for system libraries, not a path relative to the @rpath
IntuneMAMSwift vs IntuneMAMTelemetry


To Reproduce Steps to reproduce the behavior:
- Link IntuneMAMTelemetry into a test bundle or app
- Run the executable
- Observe the crash
Xcode may mask this behavior. Using an alternate build system such as Bazel will expose it.
Expected behavior:
Use the @rpath
in the load commands and not crash
Screenshots and logs:
2022-08-19 12:15:40.956 xctest[90769:73175634] (dlopen(/tmp/test_runner_work_dir.Q6VQsP/IntuneServiceTests.xctest/IntuneServiceTests,
│ 0x0109): Library not loaded: /Library/Frameworks/IntuneMAMTelemetry.framework/IntuneMAMTelemetry
7799 │ Referenced from: /private/tmp/test_runner_work_dir.Q6VQsP/IntuneServiceTests.xctest/IntuneServiceTests
7800 │ Reason: tried: '/Applications/Xcode-13.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/
│ Contents/Resources/RuntimeRoot/Library/Frameworks/IntuneMAMTelemetry.framework/IntuneMAMTelemetry' (no such file), '/Library/Frameworks/IntuneMAMTelemetry.framew
│ ork/IntuneMAMTelemetry' (no such file), '/Applications/Xcode-13.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/R
│ untimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/IntuneMAMTelemetry.framework/IntuneMAMTelemetry' (no such file))
Smartphone (please complete the following information): N/A
Intune App SDK for iOS (please complete the following information):
All 6.0.0+
This can be worked around by doctoring the supplied xcframework/framework
install_name_tool -id @rpath/IntuneMAMTelemetry.framework/IntuneMAMTelemetry IntuneMAMTelemetry.xcframework/ios-arm64_x86_64-simulator/IntuneMAMTelemetry.framework/IntuneMAMTelemetry
install_name_tool -id @rpath/IntuneMAMTelemetry.framework/IntuneMAMTelemetry IntuneMAMTelemetry.xcframework/ios-arm64/IntuneMAMTelemetry.framework/IntuneMAMTelemetry
Hi @erikkerber . Thanks for reporting this issue. Another work around would be to simply include IntuneMAMTelemetry.framework in your application's Frameworks directory. The Intune MAM SDK will load it dynamically. Your application doesn't need to link to it directly.
Thanks, Neil
Hey @neiljac1! It is already included in Frameworks, but since the load path is pointing to the system library directories it can't be found.
It's a bit of a bulge of text, but the locations the runtime looks for it are listed in the last snippet above:
Reason: tried: '/Applications/Xcode-13.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/
│ Contents/Resources/RuntimeRoot/Library/Frameworks/IntuneMAMTelemetry.framework/IntuneMAMTelemetry' (no such file), '/Library/Frameworks/IntuneMAMTelemetry.framew
│ ork/IntuneMAMTelemetry' (no such file), '/Applications/Xcode-13.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/R
│ untimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/IntuneMAMTelemetry.framework/IntuneMAMTelemetry' (no such file))
I am able to work around the issue for now by patching the SDK in-situ from our builds using a variation of the command above. It works for tests, and I assume (but we'll know soon) that it fixes on device as well.
@neiljac1 was this fixed intentionally? I don't appear to see it in 18.0.1, but also haven't checked recent versions.
Hi @erikkerber, yes this was fixed in 17.7.2.
Thanks, Neil