From 9de8bd4d5a1d76883247792c852788e4210784a8 Mon Sep 17 00:00:00 2001 From: Ace Levenberg Date: Thu, 10 Dec 2015 11:42:25 -0800 Subject: [PATCH] use firstObject on the childViewControllers aray instead of indexing by 0 --- OneDriveSDK/Auth/ODBaseAuthProvider.m | 2 +- OneDriveSDK/Auth/ODBusinessAuthProvider.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OneDriveSDK/Auth/ODBaseAuthProvider.m b/OneDriveSDK/Auth/ODBaseAuthProvider.m index 72d727b..86dca90 100644 --- a/OneDriveSDK/Auth/ODBaseAuthProvider.m +++ b/OneDriveSDK/Auth/ODBaseAuthProvider.m @@ -48,7 +48,7 @@ - (instancetype)initWithServiceInfo:(ODServiceInfo *)serviceInfo - (void) authenticateWithViewController:(UIViewController *)viewController completion:(void (^)(NSError *error))completionHandler; { // Get the view controller on the top of the stack - UIViewController *presentingViewController = [viewController childViewControllers][0]; + UIViewController *presentingViewController = [[viewController childViewControllers] firstObject]; // if the view controller's child is an ODAuthenticationViewController we just want to redirect to a new URL // not push another view controller if (presentingViewController && [presentingViewController respondsToSelector:@selector(redirectWithStartURL:endURL:success:)]){ diff --git a/OneDriveSDK/Auth/ODBusinessAuthProvider.m b/OneDriveSDK/Auth/ODBusinessAuthProvider.m index 5993ff1..1f74f57 100644 --- a/OneDriveSDK/Auth/ODBusinessAuthProvider.m +++ b/OneDriveSDK/Auth/ODBusinessAuthProvider.m @@ -44,7 +44,7 @@ - (void) authenticateWithViewController:(UIViewController*)viewController comple self.authContext.parentController = viewController; // If the disambiguation page is still being displayed remove it from the view if (self.authContext.parentController){ - UIViewController *childViewController = [viewController childViewControllers][0]; + UIViewController *childViewController = [[viewController childViewControllers] firstObject]; if (childViewController && [childViewController respondsToSelector:@selector(redirectWithStartURL:endURL:success:)]){ self.authContext.parentController = viewController.presentingViewController; dispatch_async(dispatch_get_main_queue(), ^{