Ironically, I had a similar issue while using the facebook-ios-sdk
in order to add facebook support to one of my three20 apps. my controller expected to get the Facebook url response, however, it was impossible to use the standard TTNavigator
url mapping.
I had to find a way to call the Facebook object on the controller to pass the incoming url. when TTNavigator
manage the controller stack for you, you can't "access" the controllers from anywhere else besides the controller itself.
I ended up setting the controller has a private parameter of the app delegate and using that in the TTURLMap
.
@class PhotoEditorController;
@interface PhotoBoothAppDelegate : NSObject <UIApplicationDelegate> {
PhotoEditorController* _photoEditorController;
}
@property(nonatomic, retain) PhotoEditorController* photoEditorController;
@end
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
@implementation PhotoBoothAppDelegate
@synthesize photoEditorController = _photoEditorController;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark UIApplicationDelegate
///////////////////////////////////////////////////////////////////////////////////////////////////
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
TTNavigator* navigator = [TTNavigator navigator];
navigator.persistenceMode = TTNavigatorPersistenceModeNone;
navigator.window = [[UIWindow alloc] initWithFrame:TTScreenBounds()];
TTURLMap* map = navigator.URLMap;
_photoEditorController = [[PhotoEditorController alloc] init];
// Any URL that doesn't match will fall back on this one, and open in the web browser
[map from:@"*" toViewController:[TTWebController class]];
[map from:@"tt://photo" toViewController:_photoEditorController transition:UIViewAnimationTransitionCurlUp];
// Before opening the tab bar, we see if the controller history was persisted the last time
if (![navigator restoreViewControllers]) {
[navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://intro"]];
}
return YES;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [[_photoEditorController facebook] handleOpenURL:url];
}
This code still uses the TTNaviagtor
, however, you still have references to the controllers, meaning you can directly access their parameters.
Overall, I would strongly suggest avoiding TTNavigator
. Its iPad support is almost nonexistent and broken.