1

Kullanıcıların çevrelerindeki kişileri almaya çalışıyorum. GPPSignin depricated beri giriş için GIDSignIn kullanıyorum. Ancak GIDSignIn tarafından sağlanan kimlik doğrulaması, GTLServicePlusKullanıcıları Google+ Çevrelerinden Al iOS

'da kullanılamayan GIDAuthentication türünde GIDSignInButton kullanarak başarıyla oturum açmış durumdayım. İşte Bu yüzden şu anda elle GTMOAuth2Authentication nesnesi oluşturma ve bilgileri istenilen değerler atayarak bu sorunu çözme am insanlar

GTLServicePlus* plusService = [[[GTLServicePlus alloc] init] autorelease]; 
plusService.retryEnabled = YES; 

[plusService setAuthorizer:[GPPSignIn sharedInstance].authentication]; //Problem is here 
GTLQueryPlus *query = 
[GTLQueryPlus queryForPeopleListWithUserId:@"me" 
           collection:kGTLPlusCollectionVisible]; 
[plusService executeQuery:query 
    completionHandler:^(GTLServiceTicket *ticket, 
         GTLPlusPeopleFeed *peopleFeed, 
         NSError *error) { 
     if (error) { 
      GTMLoggerError(@"Error: %@", error); 
     } else { 
      // Get an array of people from GTLPlusPeopleFeed 
      NSArray* peopleList = [peopleFeed.items retain]; 
     } 
    }]; 
+0

Bu sorunu çözdünüz mü? –

+0

@AlexanderVolkov Şu anda GTMOAuth2Authentication nesnesini el ile oluşturuyorum ve gerekli tüm alanları, clientID, userEmail, userID, accessToken, refreshToken, expirationDate öğelerini atayım. Şu an için çalışıyor. –

+0

Yani, her iki çerçeveyi kullanıyorsunuz - eski Goolge Plus SDK ve Google Sign-In, doğru mu? Bir örnek verebilir misiniz? Google Plus Web API'sini kullanmayı denediniz mi? –

cevap

0

listelemek almak benim koddur. Bu benim mevcut kodum.

func fetchGPlusContacts() { 

    let plusService = GTLServicePlus() 
    plusService.retryEnabled = true 

    let user = signIn.currentUser 
    let auth = GTMOAuth2Authentication() 

    auth.clientID = signIn.clientID 
    auth.userEmail = user.profile.email 
    auth.userID = user.userID 
    auth.accessToken = user.authentication.accessToken 
    auth.refreshToken = user.authentication.refreshToken 
    auth.expirationDate = user.authentication.accessTokenExpirationDate 

    plusService.authorizer = auth 

    let query = GTLQueryPlus.queryForPeopleListWithUserId("me", collection: kGTLPlusCollectionConnected) as! GTLQueryPlus 


    plusService.executeQuery(query) { (ticket, peopleFeed, error) in 
     if (error != nil) { 
      print("error: \(error.description)") 

      if (self.delegate != nil) { 
       if self.delegate?.failedFetchFriendsFromGoogle != nil { 
        self.delegate!.failedFetchFriendsFromGoogle!(error) 
       } 
      } 
     } 
     else { 
      if let peopleFd = peopleFeed as? GTLPlusPeopleFeed { 
       var items : [GTLPlusPerson] = [] 
       if let itms = peopleFd.items() as? [GTLPlusPerson] { 
        items = itms 
       } 
      } 
     } 
    } 
} 

Hala bu görevi gerçekleştirmenin doğru yolunu arıyorum.