hello,
I'm using TTNavigator to push TTTableViewController. I want to pass
the object to ViewController when it is pushed.
TTNavigator *navigator = [TTNavigator navigator];
navigator.window = window;
TTURLMap *map = navigator.URLMap;
[map from:[Character class] name:@"character" toURL:@"tt://
character/"]; //mapped the class
[map from:@"tt://characterList/(init)" toSharedViewController:
[CharacterListController class]]; //derived TTTableViewController
[map from:@"tt://character/(initWithCharacter:)"
toSharedViewController:[CharacterDetailController class]];
and My "CharacterListController" is implemented as follows:
@implementation CharacterListController
- (id)init {
if (self = [super init]) {
self.tableViewStyle = UITableViewStyleGrouped;
self.title = @"Characters";
TTListDataSource *dataSource = [[[TTListDataSource alloc]
init] autorelease];
NSMutableArray *characters = [[CharacterData
sharedCharacterData] characters]; // returns the initialized object
from the array
for(int i = 0; i < [characters count]; i++) {
Character *character = (Character *) [characters
objectAtIndex:i];
//NSLog(@"Character URL:%@",[character
URLValueWithName:@"character"]);
TTTableItem *tableItem = [TTTableSubtitleItem
itemWithText:
character.name
subtitle:[NSString
stringWithFormat:@"Level %d %@", character.level,
character.rpgClassName]
URL:[character
URLValueWithName:@"character"]]; ///
object to pass
[dataSource.items addObject:tableItem];
}
self.dataSource = dataSource;
}
return self;
}
and when cell is tapped I'm pushing "CharacterDetailController" and
want to call its method "-(id)initWithCharacter:(Character *)"
@implementation CharacterDetailController
- (id)intWithCharacter:(Character *)character
{
if (self = [super init]) {
NSLog(@"character:%@",[character description]);
}
}
But when I run the application it crashes when
"CharacterListController" is pushed while its data source is
initialized at:
''
TTTableItem *tableItem = [TTTableSubtitleItem
itemWithText:
character.name
subtitle:[NSString
stringWithFormat:@"Level %d %@", character.level,
character.rpgClassName]
URL:[character
URLValueWithName:@"character"]]; /// here the application
crashes
"
here is the stack trace of the crashing reason:
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '+[NSInvocation
invocationWithMethodSignature:]: method signature argument cannot be
nil'
*** Call stack at first throw:
(
0 CoreFoundation 0x01044be9
__exceptionPreprocess + 185
1 libobjc.A.dylib 0x011995c2
objc_exception_throw + 47
2 CoreFoundation 0x00fb4b09 +[NSInvocation
invocationWithMethodSignature:] + 553
3 MyTest 0x0000a765 -[TTURLSelector
perform:returnType:] + 232
4 MyTest 0x0000ac98 -[TTURLWildcard
convertPropertyOfObject:] + 105
5 MyTest 0x00006f72 -
[TTURLGeneratorPattern generateURLFromObject:] + 379
6 MyTest 0x00006939 -[TTURLMap
URLForObject:withName:] + 212
7 MyTest 0x000757e9 -
[NSObject(TTCategory) URLValueWithName:] + 102
8 MyTest 0x000ac27b -
[CharacterListController init] + 352
9 MyTest 0x00009593 -
[TTURLNavigatorPattern createObjectFromURL:query:] + 261
10 MyTest 0x00006312 -[TTURLMap
objectForURL:query:pattern:] + 241
11 MyTest 0x0000cca5 -[TTBaseNavigator
viewControllerForURL:query:pattern:] + 640
12 MyTest 0x0000c223 -[TTBaseNavigator
openURLAction:] + 843
13 MyTest 0x000ab80a -
[RPGCharsAppDelegate applicationDidFinishLaunching:] + 411
14 UIKit 0x0054e253 -[UIApplication
Any help will be appreciated. plz help me I'm stuck here for two days
and struggling to get things right way.