Iphone 在URL中传递本机对象

Iphone 在URL中传递本机对象,iphone,objective-c,ipad,three20,Iphone,Objective C,Ipad,Three20,我在学习教程 我的密码是: - (void) didSelectObject:(id) object atIndexPath:(NSIndexPath*) indexPath { Group * group = (Group *)((RKMappableObjectTableItem *) object).object; [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; group.u

我在学习教程

我的密码是:

- (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];

}
我已将映射设置为:

[map from:@"tt://group" toSharedViewController:[TopicsViewController class]];
在我的TopicsViewController中,我都尝试过:

- (id) initWithNavigatorURL:(NSURL*)URL query:(NSDictionary*)query {
但它不起作用。好像找不到任何映射。为什么会这样?我做错了什么

更新:

以下是根据建议更新的代码:

 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 

我在这里做错了什么?

我不太了解three20,但我认为您首先需要创建一个指向要传递的对象的URL,该URL可以映射

看起来three20在nsobject上提供了一个类别,允许您调用:
NSString*url=[MyFoooObject URLValueWithName:@“barName”]

几乎任何框架类都应该从NSObject继承此方法


请参阅您发布的教程中URL映射方法一章中的NSObjects to URL。

您没有告诉它要选择哪个选择器!首先,在映射的末尾添加一个
:@“tt://group?”

添加任何查询字典时,它们都会像url中的普通参数一样发送(
?foo=bar&apple=orange


接下来,如果您不打算将选择器用作URL映射的一部分,请使用
from:toSharedViewController:selector:
方法将选择器设置为您希望调用的选择器。

据我所知。。。当我们将对象作为参数传递时,您没有设置对象的URL。。如果设置对象的URL,在我的例子中URL是什么样子的?我实际上只希望它调用initWithNavigatorURL:(NSURL*)URL查询:(NSDictionary*)查询,而不是另一个选择器。。。看到了一些其他的例子,但似乎没有人使用它。。你能详细说明一下吗。即使在我就上述问题链接的三个20文档中。。它没有使用?为什么您关心init方法中的navigatorURL?你为什么需要它?无论哪种方式,都可以将选择器设置为@selector(initWithNavigatorURL:)。实际上,我并不关心navigatorURL,我只关心传递的对象。。不管怎样,我尝试了你的建议,但仍然不起作用……你缺少选择器中的“:”和?在映射中执行,而不是操作。方法名称错误。您的选择器是initWithNavigatorURL,而不是…NavigationURL