@@ -44,7 +44,7 @@ Add the following entry to your app’s Info.plist:
44
44
<dict >
45
45
<key >CFBundleURLSchemes</key >
46
46
<array >
47
- <string >msauth.com.yourcompany.yourapp </string >
47
+ <string >msauth.your.bundle.id </string >
48
48
</array >
49
49
</dict >
50
50
</array >
@@ -374,7 +374,7 @@ application.acquireToken(with: parameters) { (result, error) in
374
374
375
375
** Use Instead:**
376
376
- ` accountForIdentifier:error: `
377
- - Use other synchronous or asynchronous account retrieval APIs like ` accountsFromDeviceWithCompletionBlock :` depending on your scenario
377
+ - Use other synchronous account retrieval APIs like ` accountsForParameters:error :` depending on your scenario
378
378
379
379
Objective-C – Before (Deprecated):
380
380
``` objc
@@ -395,11 +395,18 @@ NSError *error = nil;
395
395
MSALAccount *account = [application accountForIdentifier:@"accountId"
396
396
error:&error];
397
397
398
- // Recommended modern asynchronous way to fetch accounts
399
- [application accountsFromDeviceWithCompletionBlock:^(NSArray<MSALAccount *> *accounts, NSError *error)
400
- {
398
+ // Recommended synchronous way to fetch accounts
399
+ MSALAccountEnumerationParameters *parameters = [[MSALAccountEnumerationParameters alloc] initWithIdentifier:identifier];
400
+ NSArray<MSALAccount *> *accounts = [application accountsForParameters:parameters
401
+ error:&error];
402
+ if (error)
403
+ {
404
+ NSLog(@"Failed to retrieve accounts: %@", error.localizedDescription);
405
+ }
406
+ else
407
+ {
401
408
// Handle accounts
402
- }];
409
+ }
403
410
```
404
411
405
412
Swift – Before (Deprecated):
@@ -411,8 +418,13 @@ do {
411
418
print (" Failed to get account: \( error ) " )
412
419
}
413
420
414
- application.allAccountsFilteredByAuthority { (accounts, error) in
415
- // Handle accounts
421
+ let parameters = MSALAccountEnumerationParameters (identifier : identifier)
422
+
423
+ do {
424
+ let accounts = try application.accounts (for : parameters)
425
+ // Handle account
426
+ } catch {
427
+ print (" Failed to retrieve accounts: \( error ) " )
416
428
}
417
429
```
418
430
0 commit comments