GTMOAuth2ViewControllerTouch and initWithCoder

54 views
Skip to first unread message

Bill Kocik

unread,
Mar 24, 2013, 12:05:25 PM3/24/13
to gtm-o...@googlegroups.com
My application uses storyboards, and in application:didFinishLaunchingWithOptions I'm checking to see if I have a valid GTMOAuth2Authentication instance that can sign requests. If I don't, I want to instantiate my auth view controller (which subclasses GTMOAuth2ViewControllerTouch) from the storyboard and make it the root view controller; normally my MainViewController would be root.

The trouble I'm facing is that when you instantiate a view controller from a storyboard, it is initialized by a call to initWithCoder. If within that method you call another initializer and assign it to self, the returned instance is no longer one which was freeze-dried in a NIB file, so any segues you've given it through IB are not available (and if you don't assign it to self there's a compiler error). I thought I'd get around this by mimicking one of the existing init methods and calling the same setters it does. Immediately I ran into the signIn_ ivar, which is private and has no accessor, so that approach will not work.

Any advice on how to set up a GTMOAuth2ViewControllerTouch subclass in initWithCoder?

Thanks...

David Phillip Oster (☃)

unread,
Mar 25, 2013, 12:59:10 PM3/25/13
to gtm-o...@googlegroups.com
Don't. The storyboard doesn't have enough information to instantiate a GTMOAuth2ViewControllerTouch. Instantiate it in code.


--
You received this message because you are subscribed to the Google Groups "GTM OAuth 2 Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gtm-oauth2+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages