Browse Source

UIView.frame should only be used from the main thread.

Peter Andrews 4 năm trước cách đây
mục cha
commit
74340d79ce
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      Sample/Source/SignInViewController.m

+ 3 - 3
Sample/Source/SignInViewController.m

@@ -247,11 +247,11 @@ static NSString *const kCredentialsButtonAccessibilityIdentifier = @"Credentials
   dispatch_queue_t backgroundQueue =
       dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
   __weak SignInViewController *weakSelf = self;
+  NSUInteger dimension = round(self.userAvatar.frame.size.width * [[UIScreen mainScreen] scale]);
+  NSURL *imageURL =
+      [[GIDSignIn sharedInstance].currentUser.profile imageURLWithDimension:dimension];
 
   dispatch_async(backgroundQueue, ^{
-    NSUInteger dimension = round(self.userAvatar.frame.size.width * [[UIScreen mainScreen] scale]);
-    NSURL *imageURL =
-        [[GIDSignIn sharedInstance].currentUser.profile imageURLWithDimension:dimension];
     NSData *avatarData = [NSData dataWithContentsOfURL:imageURL];
 
     if (avatarData) {