我正在覆盖地图视图并使用 RegexKitLite。我无法让它工作。我已经下载了 .m 和 .h 文件并添加到项目中。我也尝试过,添加 libicucore.dylib 或 libicucore.A.dlib 或将 -licucore 添加到其他编译器标志字段。仍然收到错误:
2012-04-01 19:38:04.633 sennerdeysen[907:15803] -[__NSCFString stringByMatching:capture:]:无法识别的选择器发送到实例 0x88b6a00 2012-04-01 19:38:04.634 sennerdeysen[907:15803] *终止应用程序由于未捕获的异常 'NSInvalidArgumentException',原因:'-[__NSCFString stringByMatching:capture:]: unrecognized selector sent to instance 0x88b6a00'
任何想法?
最新的 Xcode 但 sdk 是 4.3
没有 ARC 或 iOS 5.0 SDK 提供的任何其他东西。
这是我调用 stringbymatching 方法的函数:
-(NSArray*) calculateRoutesFrom:(CLLocationCoordinate2D) f to: (CLLocationCoordinate2D) t {
NSString* saddr = [NSString stringWithFormat:@"%f,%f", f.latitude, f.longitude];
NSString* daddr = [NSString stringWithFormat:@"%f,%f", t.latitude, t.longitude];
NSString* apiUrlStr = [NSString stringWithFormat:@"http://maps.google.com/maps?output=dragdir&saddr=%@&daddr=%@", saddr, daddr];
NSURL* apiUrl = [NSURL URLWithString:apiUrlStr];
NSError *error;
NSString *apiResponse=[NSString stringWithContentsOfURL:apiUrl encoding:NSASCIIStringEncoding error:&error];
if(apiResponse)
{
NSString* encodedPoints = [apiResponse stringByMatching:@"points:\\\"([^\\\"]*)\\\"" capture:1L];
NSLog(@"%@",encodedPoints);
return [self decodePolyLine:[encodedPoints mutableCopy]];
}
else
{
UIAlertView *alertView=[[[UIAlertView alloc]initWithTitle:@"Hata"
message:@"Rota çizilemedi. Lütfen daha sonra tekrar deneyiniz."
delegate:nil
cancelButtonTitle:@"Tamam"
otherButtonTitles:nil] autorelease];
[alertView show];
return nil;
}
}