我正在制作一个可以显示从A点到B点驾驶路线的应用程序。
我正在使用iOS Map Kit。
首先,我从谷歌获取路线信息,如下所示:
http://maps.googleapis.com/maps/api/directions/xml?origin=44.00771,20.911982&waypoints=44.814785,20.419936&sensor=false
这个功能会返回XML,我从返回的XML的“steps”中解析经度和纬度,并使用它在地图上绘制路径。
问题是绘制的路径不完整。
我认为返回的XML中没有足够的信息来绘制完整的路径,我想知道这是怎么可能的。
我在Web Google地图上输入这两个位置,它可以很好地绘制路径。因此,这个XML中可能没有足够的信息,或者我在这里做错了什么,我是否调用了正确的Web服务?
当我通过下面的应用程序传递点时,应用程序会崩溃,出现以下错误:
do {
b = [encoded characterAtIndex:index++] - 63;
出现错误:
**Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFString characterAtIndex:]: Range or index out of bounds'**
aprkGmus~B?UHk@b@{BTkBL}A@_AGk@WiAc@kBUaBOgC?KGiAMmAWsA_@uAYmA_@qA[oAI[Uy@IUQg@_AaBs@y@kAk@_Bi@y@]m@c@Y_@[c@IOOUMWCEiAsAy@{@aCiBqCkBiAeA_BkBkBiByDeD]YyDgDmBqBq@s@sA}Ak@s@cAgAiAqAcBcBsLqJmI{Gq@o@cAu@s@s@gA}@MIk@k@a@_@gAaAcPiRUKY_@{BmCaKcLoQqVEIe]kl@eJqP{Pk[sWoe@cEiE_@a@sH_I}IiIGEaFoE]YkAcAqF_FeFwEcEuEcCaDaDaFmAwBwAoCeDqHiJsTkDyHmAaCg@aA}BsE{D}GsGuJiIoJk@q@oB{ByCmDmHaI_DmCcBgAYOsBaA{@YeBo@aEoA{D{A}HgEaEkCeDeCeC}Bs@q@sEqDg@a@aFuBkFaAiEOaHBeHg@mBi@kCq@c@Mu@UwE}A]IOEe@OgIeBsIw@}GMuCJoB\kC`Am@`@iBjAaFpEoCrC{AzAgB|AqBhAsDfAyDRuD_@gCaAiCgBgCuCY_@qBqCSYIK{@oAIIiAmAYYcA}@cCmBmCaBiAe@yDiAuDs@oDw@_Bi@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