Hatena::ブログ(Diary)

24/7 twenty-four seven Twitter

東日本大震災緊急支援募金募集中。国際NGOワールド・ビジョン・ジャパン

Bloglinesで閲読登録 ADD TO Hatena::RSS Subscribe with livedoor Reader Add to Google

mail address

Follow me on twitter.

iPhone アプリケーション

Hatena touch LDR touch TV Listings LCD Clock MyWebClip MyWebClip LITE  Japan Subway Route Map こころくろっく 英辞郎 on the WEB for iPhone(アルク)
i-Radio くるりんぱ性格診断 英辞郎検索ランキング(アルク) kotobank - コトバンク miil

iPad アプリケーション

LCD Clock HD 「超」整理手帳 for the iPad

共著

2009-08-12

MapKitでルート案内をするライブラリを公開しました。

f:id:KishikawaKatsumi:20090812052111p:image:w160 f:id:KishikawaKatsumi:20090812052110p:image:w160 f:id:KishikawaKatsumi:20090812054915p:image:w160


MapKitフレームワーク単体では、標準のマップアプリのようなナビは作れないのですが、Google Maps APIと組み合わせることで、似たような機能を実現してみました。


GitHubリポジトリで公開しています。

kishikawakatsumi/MapKit-Route-Directions - GitHub


仕組みは、裏でJavascriptを実行して、Google Maps APIを叩いています。

結果としてルートの座標が緯度経度として返ってくるので、その値を使用して、MapViewの上にルートのラインを描画します。

Javascriptの実行エンジンにUIWebViewを使用します。


Google Maps APIのラッパーと、ラインをマップビューの上に描画する拡張から構成されています。


ラインの描画は下記の記事を参考にしました。

The Reluctant Blogger : Drawing polyines or routes on a MKMapView (Using Map Kit on the iPhone)

The Reluctant Blogger : Using MKAnnotation, MKPinAnnotationView and creating a custom MKAnnotationView in an MKMapView


使い方は下記のような感じです。

UICGDirectionsやUICGDirectionsOptionsというクラスがGoogle Maps APIのラッパーです。

APIの実行、および結果の取得に使用します。

NSString *startPoint = [NSString stringWithUTF8String:"セルリアンタワー"]
NSString *endPoint = [NSString stringWithUTF8String:"東京ディズニーランド"];

UICGDirections *diretions = [UICGDirections sharedDirections];
diretions.delegate = self;
UICGDirectionsOptions *options = [[[UICGDirectionsOptions alloc] init] autorelease];

[diretions loadWithStartPoint:startPoint endPoint:endPoint options:options];

以下のデリゲート・メソッドを用意しています。

オブジェクト初期化の終了時、および結果を取得するたびに呼ばれるメソッドです。

- (void)directionsDidFinishInitialize:(UICGDirections *)directions;
- (void)directions:(UICGDirections *)directions didFailInitializeWithError:(NSError *)error;
- (void)directionsDidUpdateDirections:(UICGDirections *)directions;
- (void)directions:(UICGDirections *)directions didFailWithMessage:(NSString *)message;

マップビューに線を引くには次のようにします。

- (void)directionsDidUpdateDirections:(UICGDirections *)directions {
    // Overlay polylines
    UICGPolyline *polyline = [directions polyline];
    NSArray *routePoints = [polyline routePoints];

    routeOverlayView = [[UICRouteOverlayMapView alloc] initWithMapView:routeMapView];
    [routeOverlayView setRoutes:routePoints];

UICGDirectionsオブジェクトからUICGPolylineオブジェクトを取得します。

UICGPolylineオブジェクトからルートの頂点座標を取り出し、UICRouteOverlayMapViewクラスに渡します。

UICRouteOverlayMapViewクラスが、マップビューの上に線を描画します。


ちょっと面白いところでは3箇所以上のルートを検索できます。

下の例は、「セルリアンタワー」「東京ドーム」「品川駅」「東京ディズニーランド」を経由するルートです。

f:id:KishikawaKatsumi:20090812054006p:image:w160 f:id:KishikawaKatsumi:20090812054002p:image:w160

まだ、作りかけですが、いろいろ遊べると思います。

よかったら、触ってみてください。


参考リンク

MarcMarc 2009/08/12 23:45 Hello

When I click on search button I get this error:

09-08-12 16:25:03.319 MapDirections[2518:20b] -JSONValue failed. Error trace is: (
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x10ab400 "Unrecognised leading character"

Does anyone have the same thing?

KishikawaKatsumiKishikawaKatsumi 2009/08/13 13:55 Hi Marc, thank you try my software.

Maybe locale is mismatched.
Change line 23 in UICGDirectionsOptions.m to
- locale = [[NSLocale currentLocale] retain];
+ locale = [[NSLocale alloc] initWithLocaleIdentifier:@"ja_JP"];

Default value in search field is mean Japanese location.
When if you search foreign locations, change locale to matched country.

MarcMarc 2009/08/13 19:19 Hi !

thank you for your reactivity, your software is good, it bring an additional value for MapKit without use a webview.

I replaced
- locale = [[NSLocale currentLocale] retain];
+ locale = [[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale currentLocale] localeIdentifier]]; // return en_US but I'm in France

if I search:

Tokyo/Osaka -> it works.
Beijing/Shanghai (city in China) -> it works
Washington/Chicago (city in US) ->it works
Lyon/Marseille (city in France) -> it works
London/Brighton (city in GB) -> it works
Liverpool/Brighton (city in GB) -> it works
Liverpool/London (city in GB) -> it works

But
London/Liverpool (city in GB)
Paris/Lyon and Lyon/Paris (city in France)
Paris/Marseille and Marseille/Paris (city in France)

doesn't works

it returns this error:

2009-08-13 11:58:46.820 MapDirections[1798:20b] -JSONValue failed. Error trace is: (
Error Domain=org.brautaset.JSON.ErrorDomain Code=8 UserInfo=0x6708370 "Illegal escape sequence '0x27'",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6709a70 "Object value expected for key: descriptionHtml",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734790 "Expected value while parsing array",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734f30 "Object value expected for key: Steps",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734cb0 "Object value expected for key: k",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734b80 "Expected value while parsing array",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734a10 "Object value expected for key: routes"
)
wait_fences: failed to receive reply: 10004003

KishikawaKatsumiKishikawaKatsumi 2009/08/14 01:48 Hi Marc,

> London/Liverpool (city in GB)
> Paris/Lyon and Lyon/Paris (city in France)
> Paris/Marseille and Marseille/Paris (city in France)

Those searching are look like successfully, but returned JSON value may be corrupted.
That cause JSON parse error.

> "Illegal escape sequence '0x27'"

I will try fix it this weekend.
I think maybe there are some bugs in Javascript in 'api.html'.

Thank you your report.

MarcMarc 2009/08/17 18:21 Hello Kishikawa

i think i've found the problem, it comes from Steps

in 'api.html', if I put "getSteps" to false, it works

function loadDirections(from, to, options) {
gdir.load("from: " + from + " to: " + to, { 'locale': 'en_US', travelMode: G_TRAVEL_MODE_DRIVING, avoidHighways: false, getPolyline: true, getSteps: false, preserveViewport: false});
}

KishikawaKatsumiKishikawaKatsumi 2009/08/18 09:40 Hello Marc.

I think it works right.

It is not necessary result of "getSteps" to draw polylines.

The points to draw polylines is included result of "getPolyline".

The result of "getSteps" is used to show directions in text.
You will see to tap a button on right of toolbar.

RRNTRRNT 2009/08/31 21:35 Thank you for your work, it is very interesting :). I wonder if you could help me in how to make the travelMode to G_TRAVEL_MODE_WALKING.
Thank you in advance.

KishikawaKatsumiKishikawaKatsumi 2009/09/01 00:42 Hi PRNT,

Edit my code to connect segmented control with travel modes.
If you select travel mode walking, with segmented control, search with walking option.

BUT G_TRAVEL_MODE_WALKING does not work now.
Maybe not supported yet in Google Maps API.

Do test the option programmatically,
write as shown.
UICGDirectionsOptions *options = [[[UICGDirectionsOptions alloc] init] autorelease];
options.travelMode = UICGTravelModeWalking;

AmitAmit 2009/10/08 22:19 startPoint:[22.279901,114.158798]
endPoint:[22.279991,114.158798]

Problem with direction.

"Illegal escape sequence '0 x27 '"

Thanks,
In advance.

AmitAmit 2009/10/12 15:55 Hi KishikawaKatsumi,

Finally i found the actual problem,
"Steps":[{"descriptionHtml":"Head <b>west</b> on <b>Queen\'s Rd C</b> toward <b>Ice House St</b>",
The problem is "Head west on Queen\'s Rd C" apostrophe 's "\'" and JSON can't parse it and return Error

Thanks, Amit.

eded 2009/10/23 12:58 Fantastic work! I have the same problem with illegal escape sequence too. The problem is when an address is not found by google maps, and it returns a "correct" address which is doing something strange to the steps-- if getSteps = NO; then polylines work and JSON is good. If getSteps = YES; then JSON is no good and this is result:

-JSONValue failed. Error trace is: (
Error Domain=org.brautaset.JSON.ErrorDomain Code=8 UserInfo=0x6708370 "Illegal escape sequence '0x27'",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6709a70 "Object value expected for key: descriptionHtml",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734790 "Expected value while parsing array",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734f30 "Object value expected for key: Steps",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734cb0 "Object value expected for key: k",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734b80 "Expected value while parsing array",
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x6734a10 "Object value expected for key: routes"
)

Amit KalariyaAmit Kalariya 2009/11/03 19:48 Hello All,

http://maps.google.com/maps?saddr=22.279991,114.158798&daddr=22.279901,114.158798

Problem on SBJsonParser.m
Here not validation for "'" like apostrophe 's (Queen's Rd C)
So it's return "Illegal escape sequence '0 x27 '"

Temporery Change:
UICGoogleMapsAPI.h Add two line before id JSONValue = [message JSONValue];

message = [message stringByReplacingOccurrencesOfString:@"\\'" withString:@"###"];
message = [message stringByReplacingOccurrencesOfString:@"'" withString:@"###"];
id JSONValue = [message JSONValue];

And replace @"###" before use like RouteListViewController.m

NSString *HTMLDetail = [step.descriptionHtml stringByReplacingOccurrencesOfString:@"###" withString:@"'"];

[textView setContentToHTMLString:HTMLDetail];

Amit KalariyaAmit Kalariya 2009/11/03 20:02 Hello All,

http://maps.google.com/maps?saddr=22.279991,114.158798&daddr=22.279901,114.158798

Problem on SBJsonParser.m
Here not validation for "'" like apostrophe 's (Queen's Rd C)
So it's return "Illegal escape sequence '0 x27 '"

Temporery Change:
UICGoogleMapsAPI.h Add two line before id JSONValue = [message JSONValue];

message = [message stringByReplacingOccurrencesOfString:@"\\'" withString:@"###"];
message = [message stringByReplacingOccurrencesOfString:@"'" withString:@"###"];
id JSONValue = [message JSONValue];

And replace @"###" before use like RouteListViewController.m

NSString *HTMLDetail = [step.descriptionHtml stringByReplacingOccurrencesOfString:@"###" withString:@"'"];

[textView setContentToHTMLString:HTMLDetail];

kkkk 2009/11/03 20:03 Hello All,

http://maps.google.com/maps?saddr=22.279991,114.158798&daddr=22.279901,114.158798

Problem on SBJsonParser.m
Here not validation for "'" like apostrophe 's (Queen's Rd C)
So it's return "Illegal escape sequence '0 x27 '"

Temporery Change:
UICGoogleMapsAPI.h Add two line before id JSONValue = [message JSONValue];

message = [message stringByReplacingOccurrencesOfString:@"\\'" withString:@"###"];
message = [message stringByReplacingOccurrencesOfString:@"'" withString:@"###"];
id JSONValue = [message JSONValue];

And replace @"###" before use like RouteListViewController.m

NSString *HTMLDetail = [step.descriptionHtml stringByReplacingOccurrencesOfString:@"###" withString:@"'"];

[textView setContentToHTMLString:HTMLDetail];

meikmeik 2009/12/13 01:18 Hi KishikawaKatsumi,
first of all, thanks so much for this wonderful piece of work. It works like a charme, or better, worked like a charme :) It happens that today I tested some functionality that always worked as it should, but today I noticed that it crashes the app. It seems that the JSON results that come from the Google Maps API changed the keys, for example, in file UICGRoute.m you are initializing the dictionary that contains the route steps by extracting the value for key "k" - worked the last months, but it seems that the key has been changed to "j" the last days. The same happens with the initialization of the polylines in file UICGPolyline.m, where you initialize the vertices with the value for key "j", but this has been changed to key "g".
I confirmed this behavior with the current version available in GIT and could reproduce the same problem. Is there any other workaround for this than changing the keys?
Thanks again for your great work
Meik

ncanteroncantero 2009/12/18 22:45 Exactly! Meik I'm suffering exactly the same troubles than you. We were using the functions perfectly but, as you said, something change from the Google Maps API side.
I'm currently researching for a solution...
Warm regards, Natalia

sumysumy 2009/12/21 03:52 はじめまして。LCD Clockなど愛用させていただいています。

この公開していただいているMapKit Route Directionsを使ってみたいと思うのですが、ライセンス形態を教えていただけないでしょうか?このライブラリを使用したアプリケーションをAppStoreで販売することは許されますか?

ぜひ使ってみたいと思うので、ご返答よろしくお願いいたします!

sumysumy 2009/12/21 03:58 確認が足りませんでした、大変申し訳ありません。
ライセンスは新BSDライセンスですね。ありがとうございます!

KishikawaKatsumiKishikawaKatsumi 2009/12/21 05:58 sumy さん、こんにちは。
コードは自由に使っていただいて結構です。
ただ、現在のコードはサンプルというつもりだったこともあって、
Undocuented API を2つほど使ってしまっています。
ただいま、Google Maps API V3 に対応した別バージョンを、Undocuented API を使わない形で
新たに書いていますので、そちらなら AppStore の審査も通せると思います。
公開まではもう少しかかりそうですが。

Amit KalariyaAmit Kalariya 2010/01/16 20:43 Hi KishikawaKatsumi,
First of all,
Thanks so much for this wonderful piece of work. It happens that today I tested route functionality that always worked as it should, but today I noticed that it crashes the app.

Direction Problem:
It seems that the JSON results that come from the Google Maps API changed the keys.

For example:
1)--------------------------------------------------------
In file UICGRoute.m you are initializing the dictionary that contains the route steps by extracting the value for key "k" to "j" - worked the last months,
but it seems that the key has been changed to "g" the last days.

UICGRoute.m:
NSDictionary *k = [dictionaryRepresentation objectForKey:@"g"]; // @"g"]; //:@"j"]; //k Amit


2)--------------------------------------------------------

In file UICGPolyline.m, where you initialize the vertices with the value for key "j" to "g", but this has been changed to key "k" now.

UICGPolyline.m
vertices = [[dictionaryRepresentation objectForKey:@"k"] retain]; //:@"g"] retain]; //@"j"] retain]; // Amit

==================================================================
The Google Maps API changed the keys problem remain again and again so for this issues, i have make the one globle solution:
------------------------------------------------------------------
1) UICGRoute.m:
NSDictionary *k = [dictionaryRepresentation objectForKey:@"g"]; // @"g"]; //:@"j"]; //k Amities
To
NSDictionary *k = [dictionaryRepresentation objectForKey:[[dictionaryRepresentation allKeys] objectAtIndex:([[dictionaryRepresentation allKeys] count]-1)]]; // @"g"]; //:@"j"]; //k Amit

2) UICGPolyline.m
vertices = [[dictionaryRepresentation objectForKey:@"k"] retain]; //:@"g"] retain]; //@"j"] retain]; // Amit
To
vertices = [[dictionaryRepresentation objectForKey:[[dictionaryRepresentation allKeys] objectAtIndex:4]] retain]; //@"k" //:@"g"] retain]; //j Amit

Note: It's working fine if google API just change only key value, but not work when google API change it's priority.
Please correct me if I'm wrong.

Thanks again for your great work.
Amit Kalariya
http://iphone-apps.virtueinfo.com/

KishikawaKatsumiKishikawaKatsumi 2010/01/17 00:31 Hi Amit,
thank you for your feedback. You are right, that the JSON key was changed.

I fixed the issue and committed the code. Update your code from GitHub.

I take your point about it is temporary treatment.
I think it is not predictable when Google API changes too.

Saqib SaudSaqib Saud 2010/02/02 18:35 Just wana say thanks!! you rock!!

Saqib SaudSaqib Saud 2010/02/10 16:56 please revert the changes amit asked

"vertices = [[dictionaryRepresentation objectForKey:[[dictionaryRepresentation allKeys] objectAtIndex:4]] retain]; "

Its really a bad practice to fetch items using indexes. Now google has changed indexed and its not working.

change back to
vertices = [[dictionaryRepresentation objectForKey:@"k"] retain];

in UICGPolyline

KishikawaKatsumiKishikawaKatsumi 2010/02/12 21:50 umm...
I revert it and comitted.
thanks for your help.

nycosnycos 2010/03/03 03:26 Hello Katsumi,

After a lot of research I am glad I found your project, really great piece of work!

I just noticed a memory leak while using your project with Instruments => Leaks.

To reproduce it, you just need to launch your project with the tool, tap "Search" and tap "Map Directions". Can you confirm that you have it as well?

All the best,
Nicolas

Saqib SaudSaqib Saud 2010/03/04 19:18 It not working again :( Now we are getting result with 'g'

its working as "vertices = [[dictionaryRepresentation objectForKey:@"g"] retain];" :'(

kotakota 2010/03/05 12:08 こんにちは。
MapKit Route Directionsを使わせて頂きたいと思っているのですが、現在はUndocumented APIを使われていますでしょうか?
AppStoreで配布をしたいと思っているので、ご確認させて頂きたく。
よろしくお願いいたします。

KishikawaKatsumiKishikawaKatsumi 2010/03/05 12:12 使ってますね。使わないバージョンもあるのですが、ついでにいろいろ変更してるのでまだ書きかけです。

kotakota 2010/03/05 13:36 ご返信ありがとうございます!
今回はソースを参考にさせていただいて、独自実装してみようかと思います。
ありがとうございました。

AndrewAndrew 2010/03/21 01:46 To get Walking Directions, you'll need to change api.html from this

gdir = new GDirections(null, null);

to this;

gdir = new GDirections(null, "<div></div>");

Martin HMartin H 2010/04/08 19:21 Hi,
I am running your excellent app in the UK. I do not get any route steps in tableview of RouteListView Controller. Do I need to anything special to make it work in UK? I'm running it in Xcode Simulator 3.1.3.

Thanks,

Martin.

StoneDream1StoneDream1 2010/05/10 22:20 こんにちは。電車での探索がコメント化されていますが、電車での探索はできないのでしょうか?

sergiomtz.losasergiomtz.losa 2010/05/12 23:13 hi all i think i found a solution, it has to be a <div> for holding warnings, write a div in api.html after on load, for example:

<body onload="initialize()" onunload="GUnload()">
<div id="route"></div>
</body>

and in GDirections construction callthe div, like this:

gdir = new GDirections(null, document.getElementById("route"));

and that's all i can do walking routes

cheers from spain!

TuTu 2010/07/19 05:29 Hi, im trying to doing direction for my app. From user location to another location. The code is practically the same, but when the gdir.load("from: " + from + " to: " + to, options) is called; there is no result from google server. I've put break points inside all directionsDidUpdateDirections func and didFailWithMessage, but those funcs was never called.

I've tested the same addresses on your app and it works fine.

Any suggestion? I've been wrestling w this problem for 3 days now

mgamga 2010/10/17 11:02 Hi

I have found your classes very useful. Thank you. Unfortunately I cannot make the list view work: the view shows blank, no steps, even though there is a polyline drawn in the map. When I NSLog(@"%d",[route numerOfSteps]); in numberOfRowsInSection I get a 0.

I get 15 (for my test from->to) when drawing the polyline in directionsDidUpdateDirections:
NSLog(@"%d", [routePoints count]);

Any ideas?

Thanks for your help.

mgamga 2010/10/17 11:03 Hi

I have found your classes very useful. Thank you. Unfortunately I cannot make the list view work: the view shows blank, no steps, even though there is a polyline drawn in the map. When I NSLog(@"%d",[route numerOfSteps]); in numberOfRowsInSection I get a 0.

I get 15 (for my test from->to) when drawing the polyline in directionsDidUpdateDirections:
NSLog(@"%d", [routePoints count]);

Any ideas?

Thanks for your help.

nicolasnicolas 2010/11/01 12:50 I just down your project, but it not run. when I run default your point. it was crash.

nicolasnicolas 2010/11/01 12:58 2010-11-01 17:56:38.734 MapDirections[486:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x6e792d0'
*** Call stack at first throw:
(
0 CoreFoundation 0x026cd919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0281b5de objc_exception_throw + 47
2 CoreFoundation 0x026cf42b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0263f116 ___forwarding___ + 966
4 CoreFoundation 0x0263ecd2 _CF_forwarding_prep_0 + 50
5 MapDirections 0x00006162 -[UICGRoute initWithDictionaryRepresentation:] + 292
6 MapDirections 0x0000601e +[UICGRoute routeWithDictionaryRepresentation:] + 72
7 MapDirections 0x00005168 -[UICGDirections goolgeMapsAPI:didGetObject:] + 388
8 MapDirections 0x0000b120 -[UICGoogleMapsAPI webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:] + 292
9 CoreFoundation 0x0263e42d __invoking___ + 29
10 CoreFoundation 0x0263e301 -[NSInvocation invoke] + 145
11 WebCore 0x031680f0 _ZL20HandleDelegateSourcePv + 64
12 CoreFoundation 0x026aed7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
13 CoreFoundation 0x0260d2cb __CFRunLoopDoSources0 + 571
14 CoreFoundation 0x0260c7c6 __CFRunLoopRun + 470
15 CoreFoundation 0x0260c280 CFRunLoopRunSpecific + 208
16 CoreFoundation 0x0260c1a1 CFRunLoopRunInMode + 97
17 GraphicsServices 0x02f322c8 GSEventRunModal + 217
18 GraphicsServices 0x02f3238d GSEventRun + 115
19 UIKit 0x002e3b58 UIApplicationMain + 1160
20 MapDirections 0x000027f4 main + 102
21 MapDirections 0x00002785 start + 53
22 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'


this is my error

nicolasmannicolasman 2010/11/01 13:01 2010-11-01 17:56:38.734 MapDirections[486:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x6e792d0'
*** Call stack at first throw:
(
0 CoreFoundation 0x026cd919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0281b5de objc_exception_throw + 47
2 CoreFoundation 0x026cf42b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0263f116 ___forwarding___ + 966
4 CoreFoundation 0x0263ecd2 _CF_forwarding_prep_0 + 50
5 MapDirections 0x00006162 -[UICGRoute initWithDictionaryRepresentation:] + 292
6 MapDirections 0x0000601e +[UICGRoute routeWithDictionaryRepresentation:] + 72
7 MapDirections 0x00005168 -[UICGDirections goolgeMapsAPI:didGetObject:] + 388
8 MapDirections 0x0000b120 -[UICGoogleMapsAPI webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:] + 292
9 CoreFoundation 0x0263e42d __invoking___ + 29
10 CoreFoundation 0x0263e301 -[NSInvocation invoke] + 145
11 WebCore 0x031680f0 _ZL20HandleDelegateSourcePv + 64
12 CoreFoundation 0x026aed7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
13 CoreFoundation 0x0260d2cb __CFRunLoopDoSources0 + 571
14 CoreFoundation 0x0260c7c6 __CFRunLoopRun + 470
15 CoreFoundation 0x0260c280 CFRunLoopRunSpecific + 208
16 CoreFoundation 0x0260c1a1 CFRunLoopRunInMode + 97
17 GraphicsServices 0x02f322c8 GSEventRunModal + 217
18 GraphicsServices 0x02f3238d GSEventRun + 115
19 UIKit 0x002e3b58 UIApplicationMain + 1160
20 MapDirections 0x000027f4 main + 102
21 MapDirections 0x00002785 start + 53
22 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'


this is my error

arsars 2010/11/11 23:04 hi
its grt tutorial
but i cant get the routes .

how i can get ROUTES ???

arsars 2010/11/12 14:51 route does't show
how i see the ROUTE??

b0bb0b 2011/01/05 19:33 UICGRoute.m

Replace:

NSArray *allKeys = [dictionaryRepresentation allKeys];
NSDictionary *k = [dictionaryRepresentation objectForKey:[allKeys objectAtIndex:[allKeys count] - 1]];

with:
NSDictionary *k = [dictionaryRepresentation objectForKey:@"D"];

InsweInswe 2011/02/23 18:58 hello everyone.... I have two co-ordinates say 45.5678,34.4567 and 45.51008,34.4298
how do I find directions by only co-ordinates not by name... Plz help me.. I'm not expert in javascript....

InsweInswe 2011/02/23 18:58 hello everyone.... I have two co-ordinates say 45.5678,34.4567 and 45.51008,34.4298
how do I find directions by only co-ordinates not by name... Plz help me.. I'm not expert in javascript....

KrishnanKrishnan 2011/04/05 22:32 Hi Friend, Thanks for your post. It really helped me.
I had some problems when using your library.

When I tried searching for a route between San Jose and Cupertino, I got no routes and I was informed through a message that one of the locations is new or wrong.
And the case is that when ever we search for route between a location and San Jose, I don't get any routes.
Can you check what the problem could be?
When I search for Routes from or to with respect to San Jose in Google Maps, it seems that there are several San Jose's available and Google asks me which one to choose.

VictorVictor 2011/05/26 20:45 kishikawakatsumi hello,
you could put the final version of your program? I'm trying to address in Spain but it is impossible always gives me error.
Thank you very much

VictorVictor 2011/05/27 01:11 It doesn't works, why???

卒検生卒検生 2011/07/05 14:15 このライブラリの導入の仕方がいまいちわかりません〜
Objective-C初心者なのですが難しいものなのでしょうか?

JulianaJuliana 2011/10/05 23:58 Hi KishikawaKatsumi,

Thank you very much for sharing your code with us. It is very useful.

KoheiKohei 2012/01/18 17:52 お世話になります。こちらのライブラリを利用したいと考えています。
しかしながら、AppStoreの審査を心配しています。
最新のライブラリもundocumentedなクラスを使用していますか?

KishikawaKatsumiKishikawaKatsumi 2012/01/18 18:11 はい。もう長いことメンテナンスしてないので。。。
コードを読んで理解できるのでしたら、修正することはそれほど難しくないですのでがんばってください。

スパム対策のためのダミーです。もし見えても何も入力しないでください
ゲスト


画像認証