Ver código fonte

Ensure additionalTokenRefreshParametersForAuthSession returns a dictionary of type <NSString *,NSString *>.

brianna 6 meses atrás
pai
commit
88640726a9
1 arquivos alterados com 15 adições e 2 exclusões
  1. 15 2
      GoogleSignIn/Sources/GIDEMMSupport.m

+ 15 - 2
GoogleSignIn/Sources/GIDEMMSupport.m

@@ -116,8 +116,21 @@ typedef NS_ENUM(NSInteger, ErrorCode) {
 
 - (nullable NSDictionary<NSString *,NSString *> *)
 additionalTokenRefreshParametersForAuthSession:(GTMAuthSession *)authSession {
-  return [GIDEMMSupport updatedEMMParametersWithParameters:
-          authSession.authState.lastTokenResponse.additionalParameters];
+  NSDictionary *originalParameters =
+      [GIDEMMSupport updatedEMMParametersWithParameters:authSession.authState.lastTokenResponse
+                                                            .additionalParameters];
+
+  // Ensure returned dictionary has values of only type String.
+  NSMutableDictionary<NSString *, NSString *> *convertedParameters =
+      [NSMutableDictionary dictionary];
+  [originalParameters enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) {
+    if ([value isKindOfClass:[NSNumber class]]) {
+      convertedParameters[key] = [value stringValue];
+    } else if ([value isKindOfClass:[NSString class]]) {
+      convertedParameters[key] = value;
+    }
+  }];
+  return convertedParameters;
 }
 
 - (void)updateErrorForAuthSession:(GTMAuthSession *)authSession