iOS应用集成Intune iOS SDK遇问题:需调用代理及请求策略吗?
Hey there! Let's break down your questions and help you get that Intune SDK integration working properly.
1. Do I need to set up a delegate for ADAL when integrating the Intune SDK?
Absolutely—this is almost certainly why your initial integration didn't take effect! The Intune iOS SDK relies on intercepting ADAL's authentication requests to inject compliance checks and enforce Intune policies. Here's exactly what you need to do:
- Create an instance of
IntuneMAMADALDelegate(a class provided directly by the Intune SDK). - Assign this delegate to your
ADAuthenticationContextusing itsdelegateproperty. - Ensure the delegate implements the
authenticationContext:willPerformHTTPRequest:method—this is the hook where Intune inserts necessary headers and validates device compliance before the auth request is sent.
Without this delegate in place, the Intune SDK can't interact with ADAL's authentication flow, so all its policy enforcement features will remain inactive.
2. If I call registerAndEnroll after successful authentication, do I still need to request policies in AppDelegate?
Yes, you should still trigger a policy request in your AppDelegate's application:didFinishLaunchingWithOptions: method, and here's why:
- While
registerAndEnrollwill trigger a policy sync in the background eventually, requesting policies at app launch ensures critical compliance rules (like blocking access for non-compliant devices) are applied immediately when the app starts. - To do this, add a call to
IntuneMAMPolicyManager.sharedInstance().requestPolicy()early in your app's launch flow. - Don't forget to set up an
IntuneMAMPolicyDelegateto handle policy updates (using methods likepolicyManager:didReceivePolicy:) so your app can react to changes after enrollment is complete.
Quick Bonus Troubleshooting Tip
If you followed the initial steps but the SDK still isn't working, double-check these common pain points:
- Confirm your app's bundle ID matches the one registered in the Intune admin center.
- Verify your ADAL authentication request includes the necessary Intune scopes (e.g.,
https://graph.microsoft.com/DeviceManagementManagedDevices.ReadWrite.All). - Make sure you're using compatible versions of ADAL and the Intune SDK (version mismatches can break integration).
内容的提问来源于stack exchange,提问作者Savanna

