2017-09-27 5 views
0

次のコードでは、あるポイントから別のポイントへのナビゲーションでGoogle MapsアプリをiPhone上で開くことはできませんが、デスクトップブラウザと同じURLをコピーすると、グーグルマップ。Objective-Cを使用してiosで複数の目的地でナビゲーションを開始

Googleマップアプリでナビゲーションを開始するにはどうすればよいですか?

列str = https://maps.google.com/maps/dir/?api=1&origin=18.606791,73.785611&destination=18.611997,73.971692&waypoints=18.606791,73.785611|18.611997,73.971692|18.465518,74.012204

if([[UIApplication sharedApplication] canOpenURL: 
    [NSURL URLWithString:@"comgooglemaps://"]]) 
{ 
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]; 
} 
+0

Yuvarajケール、あなたのコードを表示することができますし、どのように適用されていますか? – user3182143

+0

これを介して - https://stackoverflow.com/questions/41392092/google-maps-directions-url-error-when-adding-multiple-waypoints/41449231#41449231 – user3182143

答えて

0

使用可能なURLスキームでGoogleドキュメントで始めることができます。具体的には、あなたのアプリにadd navigationの方法に関するセクションがあります。

+0

私はすでにドキュメントを通過しています溶液。 –

0

これを試してみてください。..

NSString *escapedString = [strUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]]; 
    strUrl=[escapedString stringByReplacingOccurrencesOfString:@"%20" withString:@"+"]; 

if ([[UIApplication sharedApplication] canOpenURL: 
     [NSURL URLWithString:@"comgooglemaps://"]]) 
    { 
     [[UIApplication sharedApplication] openURL: 
     [NSURL URLWithString:[@"comgooglemaps://?" stringByAppendingString:strUrl]]]; 
    } 
+0

いいえ、Googleマップを開きますが、入力した場所は表示されません。 –

関連する問題