我正在使用SOCKit库为我的应用实现URL路由器。我有一个自定义的Router
类,用于跟踪所有有效路线,并实施match
方法,该方法在给定路线NSString
的情况下将其与相应的视图控制器相匹配。为了使事情更容易,匹配的视图控制器必须实现Routable
协议,该协议需要采用NSDictionary
作为参数的initWithState:
方法。下面是相关的代码:调试和发布版本之间的不同行为
- (id)match:(NSString *)route
{
for (NSArray *match in routePatterns) {
const SOCPattern * const pattern = [match objectAtIndex:kPatternIndex];
if ([pattern stringMatches:route]) {
Class class = [match objectAtIndex:kObjectIndex];
NSLog(@"[pattern parameterDictionaryFromSourceString:route]: %@", [pattern parameterDictionaryFromSourceString:route]);
UIViewController<Routable> *vc;
vc = [[class alloc] initWithState:[pattern parameterDictionaryFromSourceString:route]];
return vc;
}
}
return nil;
}
当我运行与debug
配置的应用,[pattern parameterDictionaryFromSourceString:route]
产生的期望是什么:
[pattern parameterDictionaryFromSourceString:route]: {
uuid = "e9ed6708-5ad5-11e1-91ca-12313810b404";
}
在另一方面,当我运行该应用程序会与release
配置, [pattern parameterDictionaryFromSourceString:route]
产生一个空字典。我真的不知道如何调试。我检查了自己的代码,看看debug
和release
构建之间是否存在任何明显差异,并且也查看了SOCKit source code。想法?谢谢!
对不起,这已经在https://github.com/jverkoey/sockit/commit/8e666d78ad6c888c72aaa00cdbadcd2da6ebf65d中修复了。 – featherless 2012-04-25 18:53:26
谢谢!我很高兴它现在再次运作。 – cbrauchli 2012-04-27 15:50:37