2010-09-01 18 views
2

J'utilise un TTTableSubtitleItem et je veux que sur une touche on appelle une fonction.TTNavigator de Three20 se bloque

TTURLMap *map = navigator.URLMap; 
[map from:@"*" toObject:self selector:@selector(calledFunction)]; 

mais si j'utiliser son lancer cette erreur:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSInvocation setArgument:atIndex:]: index (2) out of bounds [-1, 1]' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x02a0f919 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x02b5d5de objc_exception_throw + 47 
    2 CoreFoundation      0x0297fa88 -[NSInvocation setArgument:atIndex:] + 216 
    3 regioappv2       0x000cd3f7 -[TTURLNavigatorPattern invoke:withURL:query:] + 309 
    4 regioappv2       0x000cd57b -[TTURLNavigatorPattern createObjectFromURL:query:] + 206 
    5 regioappv2       0x000ca30e -[TTURLMap objectForURL:query:pattern:] + 241 
    6 regioappv2       0x000d0c8d -[TTBaseNavigator viewControllerForURL:query:pattern:] + 640 
    7 regioappv2       0x000d020b -[TTBaseNavigator openURLAction:] + 843 
    8 regioappv2       0x000c547b TTOpenURL + 139 
    9 regioappv2       0x000b3f9c -[TTTableViewDelegate tableView:didSelectRowAtIndexPath:] + 353 
    10 UIKit        0x00624718 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140 
    11 UIKit        0x0061affe -[UITableView _userSelectRowAtIndexPath:] + 219 
    12 Foundation       0x00331cea __NSFireDelayedPerform + 441 
    13 CoreFoundation      0x029f0d43 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19 
    14 CoreFoundation      0x029f2384 __CFRunLoopDoTimer + 1364 
    15 CoreFoundation      0x0294ed09 __CFRunLoopRun + 1817 
    16 CoreFoundation      0x0294e280 CFRunLoopRunSpecific + 208 
    17 CoreFoundation      0x0294e1a1 CFRunLoopRunInMode + 97 
    18 GraphicsServices     0x030f12c8 GSEventRunModal + 217 
    19 GraphicsServices     0x030f138d GSEventRun + 115 
    20 UIKit        0x005c0b58 UIApplicationMain + 1160 
    21 regioappv2       0x00002254 main + 102 
    22 regioappv2       0x000021e5 start + 53 
) 
terminate called after throwing an instance of 'NSException' 
Program received signal: “SIGABRT”. 

si je change le functionname rien ne se passe, de sorte que la cartographie est correctement.

S'il vous plaît laissez-moi savoir ce que je fais mal, et dites-moi si vous avez besoin de plus de code.

ce qui a trait

Répondre

0

Je pense que votre sélecteur calledFunction doit accepter un paramètre de type NSURL , bien que je ne suis pas sûr de la signature . En d'autres termes, je pense que Three20 vous attend à utiliser une méthode comme

- (void)calledFunction:(NSURL*)theURL { ... } 

au lieu de

- (void)calledFunction { ... } 

changer votre code (ne manquez pas le côlon):

[map from:@"*" toObject:self selector:@selector(calledFunction:)]; 
+0

Merci pour l'indice, ne savait pas que la fonction générique attend des paramètres – plusgut