I’m working on a handling a custom URL Scheme in an app and am trying to sort out:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
I’m passing and successfully parsing a URL into an NSDictionary in my app but wondering “what now?” handleOpenURL returns a BOOL but to what? It’s hard for me to debug as I haven’t figure out how to have debugger running on device when it fires.
All I do know is that applicationDidFinishLaunching completes before handleOpenURL and it appears as though my rootViewController is on screen.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Load data
[self initializeData];
// Configure and show the window
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
Anyway, so, now I have this NSDictionary object in my appDelegate, how would you pass it to the rootViewController so it can do something with it in its detail view? Would I call
[[navigationController topViewController] addItemWithDictionary:theDictionary];
before handleOpenURL’s return YES; Or, should I create an NSDictionary property in my appDelegate and then after “Return YES;” retrieve it from my rootViewController (or detailViewController – haven’t worked out which yet). If so what’s the trigger? It’s not clear to me where handleOpenUrl’s returns are heading…and what, if any, value they have to me.
Thanks!
I think I may have answered my own question but if you have other ideas I’d love to hear them!
I think I need to continue processing in handleOpenURL and turn the dictionary into an object that is then added to my appDelegate’s array that rootViewController is using to build it’s table view. Obviously need to work out some validation & confirmation on user’s part before auto populating array. I guess that would also happen within confines of handleOpenURL?