views:

47

answers:

1

Hi Experts,

I'm using a TTTableSubtitleItem and want that on a touch a function is called.

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

but if I' using it its throwing this error:

*** 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”.

if i change the functionname then nothing happens, so the mapping is correctly.

Please let me know what I am doing wrong, and tell me if you need more code.

regards

A: 

I think your selector calledFunction needs to accept a parameter of type NSURL , though I'm not sure of the signature. In other words, I think three20 expects you to use a method like

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

instead of

- (void)calledFunction { ... }

changing your code to (don't miss the colon):

[map from:@"*" toObject:self selector:@selector(calledFunction:)];
bosmacs
Thanks for the hint, didn't knew that the wildcard-function expects parameters
plusgut