76912

How to use GTMAppAuth in Swift

Question:

I do not know how to code in Objective-C and have to get an app working with the G Suite SDK so that I can get information about members of the groups. The problem is that <a href="https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html" rel="nofollow">in September Google changed</a> how auth requests work, <a href="https://developers.google.com/admin-sdk/directory/v1/quickstart/ios?ver=swift" rel="nofollow">so this tutorial</a> no longer works. I know I need to switch over to using <a href="https://github.com/google/GTMAppAuth" rel="nofollow">GTMAppAuth</a>, but it's all Objective-C.

Answer1:

I am currently working on YouTube Data API and trying to implement functions in Swift. The following is what I did:

<ol><li>Install GTMAppAuth using Cocoapods.</li> <li>Add bridging header and import necessary headers.</li> <li>The above 2 steps didn't result in a successful compilation, since xcode can't find the headers. I manually add header search path in build settings.</li> </ol>

After doing these steps, I can access those Objective-C class & methods from Swift classes.

For the "how to use GTMAppAuth" part, I found an example here (though I haven't test it) <a href="https://github.com/Alder85/AppAuthSwift" rel="nofollow">https://github.com/Alder85/AppAuthSwift</a>

Maybe you can also find some hints here.

(Sorry for that this is just my experience and may not be a complete answer. I am new here in the stackoverflow and have too little reputations to post a comment.)

Recommend

  • not able to acess installed pods framework
  • diff: /../Podfile.lock: No such file or directory
  • Many build errors after pod update
  • Creating a pod with cocoapods fails
  • IONIC:Unable to install phonegap-plugin-push in ios app
  • App rejected by Apple caused by using Google Maps SDK
  • CorePlot 1.2 - pod install no response
  • Ios swift - storing uiimage in document directory and path in core data
  • access parent project OTHER_SWIFT_FLAGS from pod
  • youtube video insert “onBehalfOfContentOwner” parameter value
  • In a MEAN stack, how can I do one-time MongoDB indexing?
  • Python PIL remove sections of an image based on its colour
  • Consuming a web service with the Netbeans Platform
  • if some function is not optimized does it mean that all functions where it is declared are not optim
  • Cannot page through all results using nextPageToken on YouTube search API v3
  • What causes the runtime difference in this trivial fortran code?
  • Wrong labels when plotting a time series pandas dataframe with matplotlib
  • Hide HTML elements without javascript, only CSS
  • Copy to all folders batch file?
  • What and where is mdimport
  • Alternative To body {overflow:scroll;} That Will Prevent Page Jostling/Wriggling?
  • How to attach a node.js readable stream to a Sendgrid email?
  • Moving mysql files across servers
  • Xamarin Forms - UWP Fonts
  • swift auto completion not working in Xcode6-Beta
  • How to recover from a Spring Social ExpiredAuthorizationException
  • ILMerge & Keep Assembly Name
  • Hazelcast - OperationTimeoutException
  • Large data - storage and query
  • WOWZA + RTMP + HTML5 Playback?
  • RestKit - RKRequestDelegate does not exist
  • Revoking OAuth Access Token Results in 404 Not Found
  • Angular 2 constructor injection vs direct access
  • Java static initializers and reflection
  • embed rChart in Markdown
  • Android Google Maps API OnLocationChanged only called once
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app