I was following the tutorial here.
The code I have is:
- (void) didSelectObject:(id) object atIndexPath:(NSIndexPath*) indexPath
{
Group * group = (Group *)((RKMappableObjectTableItem *) object).object;
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
group.unread = 0;
[self.tableView reloadData];
TTURLAction *action = [[[TTURLAction actionWithURLPath:@"tt://group"]
applyQuery:[NSDictionary dictionaryWithObject:group forKey:@"kParameterUser"]]
applyAnimated:YES];
[[TTNavigator navigator] openURLAction:action];
}
I have set the mapping as:
[map from:@"tt://group" toSharedViewController:[TopicsViewController class]];
and inside my TopicsViewController I have both tried:
- (id) initWithNavigatorURL:(NSURL*)URL query:(NSDictionary*)query {
but it didn’t work. It’s as if it can’t find any mapping. Why is this? What am I doing wrong?
UPDATE:
Here’s the updated code based on the suggestion:
TTURLAction *action = [[[TTURLAction actionWithURLPath:@"tt://group"]
applyQuery:[NSDictionary dictionaryWithObject:group forKey:@"kParameterUser"]]
applyAnimated:YES];
[[TTNavigator navigator] openURLAction:action];
[map from:@"tt://group?" toSharedViewController:[TopicsViewController class] selector:@selector(initWithNavigationURL:)];
- (id) initWithNavigatorURL:(NSURL*)URL query:(NSDictionary*)query
what am I doing wrong here?
You are not telling it what selector to cal! First, add a
?to the end of your mapping: @”tt://group?”When you add any query dictionaries, they are sent like normal params in a url (
?foo=bar&apple=orange).Next, if you aren’t going to use the selector as part of the URL mapping, use the
from:toSharedViewController:selector:method to set the selector to the selector you wish to call.