Mapbox падает при использовании enableDataOnMapView в xcode
В настоящее время я пытаюсь загрузить некоторые трассы GPX, которые я добавил в качестве слоев данных в мои проекты Mapbox. Я не могу найти какие-либо учебные пособия о том, как это сделать, и документация весьма минимальна, но я думаю, что я на правильном пути. При настройке моего RMMapBoxSource я использую:
normalTileSource = [[RMMapboxSource alloc] initWithMapID:[JSONDict objectForKey:@"normalJSON"] enablingDataOnMapView:rmMapView]
Тем не менее, этот код, кажется, вызывает сбой, который я сузил до этой функции в RMMapBoxSource:
- (id)initWithTileJSON:(NSString *)tileJSON enablingDataOnMapView:(RMMapView *)mapView
Кажется, что сбой происходит после этой строки:
CLLocationCoordinate2D coordinate = {
.longitude = [[[[feature objectForKey:@"geometry"] objectForKey:@"coordinates"] objectAtIndex:0] floatValue],
.latitude = [[[[feature objectForKey:@"geometry"] objectForKey:@"coordinates"] objectAtIndex:1] floatValue]
};
Это происходит потому, что аргументы.longitude ожидают, что в каждой записи словаря / массива будет присутствовать одно значение с плавающей запятой, однако, поскольку это строковые данные, геометрия фактически содержит массив массивов (см. Ниже).
(lldb) po feature
{
geometry = {
coordinates = (
(
"-1.577036955712112",
"53.45438397279663"
),
(
"-1.577283932066187",
"53.45452595243928"
),
(
"-1.577495911943196",
"53.45465193448263"
),
(
"-1.577663895584496",
"53.45474192140945"
),
(
"-1.577814879253818",
"53.45478391422645"
),
(
"-1.578035853910355",
"53.45481090776157"
),
(
"-1.578230831430296",
"53.45483190238889"
),
(
"-1.578433809749077",
"53.45489489196479"
),
(
"-1.578601791632815",
"53.45494288382392"
),
(
"-1.578769774353241",
"53.45501087333442"
),
(
"-1.578867764622101",
"53.45505886623693"
),
(
"-1.578991751525391",
"53.45510085945654"
),
(
"-1.579159734454841",
"53.45517384837989"
),
(
"-1.579344714762086",
"53.45523283869398"
),
(
"-1.579433706945633",
"53.45530082938201"
),
(
"-1.579574692230681",
"53.45535282117395"
),
(
"-1.579813666487409",
"53.45542180950893"
),
(
"-1.579981649876705",
"53.45550579714063"
),
(
"-1.58010563765821",
"53.45556878789422"
),
(
"-1.580282620220255",
"53.45565877468723"
),
(
"-1.580308618611717",
"53.45569477007211"
),
(
"-1.580210633196074",
"53.45576276354715"
),
(
"-1.58008665265216",
"53.45587275247748"
),
(
"-1.579970672195915",
"53.45600773835274"
),
(
"-1.579872689625363",
"53.4561437238423"
),
(
"-1.579810700106625",
"53.45621671619365"
),
(
"-1.579730713622791",
"53.45631070634716"
),
(
"-1.579658725511261",
"53.4563886982604"
),
(
"-1.57964073160034",
"53.45648268748985"
),
(
"-1.579658732498264",
"53.45655567864888"
),
(
"-1.579711729245241",
"53.45662966916878"
),
(
"-1.579746726558638",
"53.4566656644195"
),
(
"-1.579763728036581",
"53.45674965430162"
),
(
"-1.579745735004357",
"53.45686464106492"
),
(
"-1.579718741544114",
"53.45694363219"
),
(
"-1.579691749129889",
"53.45704762037921"
),
(
"-1.579664755878907",
"53.45713161091711"
),
(
"-1.579637762586115",
"53.45721460157243"
),
(
"-1.579610769335193",
"53.45729859211032"
),
(
"-1.579583775833256",
"53.45737658335283"
),
(
"-1.579574778250328",
"53.45740857972906"
),
(
"-1.57944279251529",
"53.45737158604157"
),
(
"-1.579318805821851",
"53.45733459223485"
),
(
"-1.579185819955492",
"53.45729159926692"
),
(
"-1.5790708315562",
"53.45723960708761"
),
(
"-1.578973841628192",
"53.45720261287849"
),
(
"-1.578805859326921",
"53.45714462219381"
),
(
"-1.578663874371194",
"53.4570976298298"
),
(
"-1.57859288153765",
"53.45706563464601"
),
(
"-1.57850489032217",
"53.45702364088996"
),
(
"-1.578415899226463",
"53.4569816471488"
),
(
"-1.578327908220158",
"53.45694465280559"
),
(
"-1.5782399167954",
"53.45689765963672"
),
(
"-1.578168923292281",
"53.45684966633191"
),
(
"-1.578053935101909",
"53.4568026735655"
),
(
"-1.57797494192944",
"53.45673968214144"
),
(
"-1.577920947310341",
"53.45671368599967"
),
(
"-1.57781495737225",
"53.45665069497808"
),
(
"-1.57771796656521",
"53.45659270323519"
),
(
"-1.577629975140295",
"53.45654571006634"
),
(
"-1.577540983584083",
"53.45649271761702"
),
(
"-1.577417995263894",
"53.45641972802322"
),
(
"-1.577320004785753",
"53.45636673570807"
),
(
"-1.577250011204483",
"53.45631974227093"
),
(
"-1.577161019899239",
"53.45627274911703"
),
(
"-1.577020033693308",
"53.456198759909"
),
(
"-1.576931043015685",
"53.4561667649936"
),
(
"-1.576843051590572",
"53.45611977182482"
),
(
"-1.576710065095722",
"53.45606178061864"
),
(
"-1.576578079359801",
"53.45602478693144"
),
(
"-1.576410097057529",
"53.45596679624705"
),
(
"-1.576312107499741",
"53.45593580134843"
),
(
"-1.576162123041153",
"53.45587781039572"
),
(
"-1.57610012979858",
"53.45586181319894"
),
(
"-1.576171119326703",
"53.45581481765986"
),
(
"-1.576260106698632",
"53.45576782185243"
),
(
"-1.576331096436029",
"53.45572582572618"
),
(
"-1.576393087293397",
"53.45568482961667"
),
(
"-1.576429081014235",
"53.45563783459936"
),
(
"-1.576456075352893",
"53.455579841008"
),
(
"-1.576500067906224",
"53.45552784645858"
),
(
"-1.576571057016044",
"53.45547085209385"
),
(
"-1.576589052223639",
"53.4554078592238"
),
(
"-1.576634043569294",
"53.45532986771276"
),
(
"-1.576670036829955",
"53.45527187398721"
),
(
"-1.576732026599545",
"53.45520488093097"
),
(
"-1.576812013501648",
"53.45512088960277"
),
(
"-1.576874003689739",
"53.45506389537222"
),
(
"-1.57698998782773",
"53.45501689916236"
),
(
"-1.577060977356207",
"53.45496990362333"
),
(
"-1.577184959029658",
"53.45488691152183"
),
(
"-1.577255948558195",
"53.45483991598281"
),
(
"-1.577353932216531",
"53.45472992743959"
),
(
"-1.577433920039445",
"53.45466793352791"
),
(
"-1.577354926866696",
"53.45460494210376"
),
(
"-1.577230938875128",
"53.45453695193758"
),
(
"-1.577168944293561",
"53.45448895849854"
),
(
"-1.577071954155549",
"53.45444696487665"
),
(
"-1.577009960285242",
"53.45441596944129"
),
(
"-1.576965964007728",
"53.45437897444217"
),
(
"-1.576841974886314",
"53.45428398744669"
),
(
"-1.576770980336715",
"53.45421099707764"
),
(
"-1.576682987823447",
"53.454138006962"
),
(
"-1.576585996555583",
"53.45406901651081"
),
(
"-1.576533001397909",
"53.45403302152845"
),
(
"-1.576197039386156",
"53.45397903287863"
),
(
"-1.576073052942334",
"53.45394803836755"
),
(
"-1.575905071057671",
"53.45390004650877"
),
(
"-1.575772085231569",
"53.45385805342363"
),
(
"-1.575639098945156",
"53.45380506163027"
),
(
"-1.575551108398205",
"53.45377906599541"
),
(
"-1.575436120625117",
"53.45374207205482"
),
(
"-1.575294137383311",
"53.45373607487637"
),
(
"-1.575188149661912",
"53.45372607763096"
),
(
"-1.575064163385244",
"53.45369908265029"
),
(
"-1.574922177967459",
"53.45364109157833"
),
(
"-1.574807190654529",
"53.45361509634606"
),
(
"-1.574674205246593",
"53.45358310208675"
),
(
"-1.574542219969917",
"53.45355710710795"
),
(
"-1.574462228213454",
"53.45352511205847"
),
(
"-1.574170259884024",
"53.45344612568905"
),
(
"-1.574002277998752",
"53.45339813383055"
),
(
"-1.573922286493275",
"53.45337213807653"
),
(
"-1.573807298929057",
"53.45334014354894"
),
(
"-1.573683311354813",
"53.45328215220876"
),
(
"-1.573568324041621",
"53.4532561569766"
),
(
"-1.573444337136871",
"53.45321416375756"
),
(
"-1.573338347824944",
"53.45316617097472"
),
(
"-1.573161366389684",
"53.45310318101198"
),
(
"-1.573064375832265",
"53.4530511885647"
),
(
"-1.57296738590255",
"53.45301419435595"
),
(
"-1.572887394145797",
"53.45298219930658"
),
(
"-1.572746408607524",
"53.45292420821997"
),
(
"-1.572640420216095",
"53.4528982128537"
),
(
"-1.572542430196818",
"53.45285621924706"
),
(
"-1.572498438731395",
"53.45293421074356"
),
(
"-1.572453447846136",
"53.45302320096323"
),
(
"-1.572408455830956",
"53.45308519435351"
),
(
"-1.57236446373787",
"53.45314818761146"
),
(
"-1.572293475297391",
"53.45322118009771"
),
(
"-1.572221486307108",
"53.45327817447777"
),
(
"-1.572141498735468",
"53.45334616768538"
),
(
"-1.572017516643486",
"53.45341916096195"
),
(
"-1.5719195321069",
"53.45350815197193"
),
(
"-1.571759554285302",
"53.45358014590279"
),
(
"-1.57165357049783",
"53.45366413761924"
),
(
"-1.571582579420844",
"53.45367413750369"
),
(
"-1.571493590081377",
"53.45367413883087"
),
(
"-1.571343607588154",
"53.45366314235942"
),
(
"-1.571219622441011",
"53.45366314420856"
),
(
"-1.571174627580027",
"53.45365714558421"
),
(
"-1.571245622800694",
"53.45374613407407"
),
(
"-1.571315617722569",
"53.45382512375315"
),
(
"-1.571395611446607",
"53.45390411328312"
),
(
"-1.571518600438543",
"53.45399310099754"
),
(
"-1.571669587834432",
"53.45412408336232"
),
(
"-1.571730582076327",
"53.45416107810773"
),
(
"-1.571890566426876",
"53.45424506585759"
),
(
"-1.571996555948159",
"53.45429805805308"
),
(
"-1.572111543679835",
"53.4543340521107"
),
(
"-1.572243529417016",
"53.45437104579739"
),
(
"-1.57231452179131",
"53.4543920422726"
),
(
"-1.572518498066928",
"53.45440903723437"
),
(
"-1.572660481266877",
"53.45441403452983"
),
(
"-1.572890453967664",
"53.45442003039571"
),
(
"-1.572979443306876",
"53.45442002906865"
),
(
"-1.573165421278124",
"53.45442602559067"
),
(
"-1.573306403300404",
"53.4544000265415"
),
(
"-1.573475383517212",
"53.45441102272991"
),
(
"-1.573643363435276",
"53.45441202010758"
),
(
"-1.573776348173533",
"53.45442801624564"
),
(
"-1.573953327431994",
"53.45443901231481"
),
(
"-1.57413930494278",
"53.45443401012879"
),
(
"-1.574290285767207",
"53.45440801093068"
),
(
"-1.574538255893164",
"53.4544040077029"
),
(
"-1.574653242117892",
"53.45440400598835"
),
(
"-1.574857217263272",
"53.45439400412123"
),
(
"-1.574990200704155",
"53.45437900389985"
),
(
"-1.575256168213612",
"53.45436400169565"
),
(
"-1.575371153768785",
"53.4543480018601"
),
(
"-1.575628122816586",
"53.45434399849841"
),
(
"-1.575805100317408",
"53.45431299950009"
),
(
"-1.575974078985746",
"53.45428700003392"
),
(
"-1.576116061767002",
"53.45428199850419"
),
(
"-1.576364031892828",
"53.45427799527688"
),
(
"-1.576585005880464",
"53.45428899069063"
),
(
"-1.576699993192978",
"53.45431498592306"
),
(
"-1.57679798212342",
"53.45433098258328"
),
(
"-1.577027956580985",
"53.45437897351796"
)
);
type = LineString;
};
properties = {
description = "";
id = "marker-hqqqqc9l0";
stroke = "#1087bf";
"stroke-opacity" = 1;
"stroke-width" = 4;
title = Route2;
};
type = Feature;
}
Может кто-нибудь сказать мне, какую функцию я должен использовать, чтобы нарисовать мои данные GPX / RMPolylineAnnotation, поскольку я не могу понять это.
Спасибо
1 ответ
-enablingDataOnMapView:
Аргумент связан с серверными маркерами Mapbox, которые выбираются и автоматически добавляются на карту на основе изменений, которые вы сделали в онлайн-редакторе Mapbox. Это не полезно для ваших собственных пользовательских данных.
Так же mapID
Аргументом является идентификатор карты Mapbox, а не JSON.
Посмотрите документы здесь: https://www.mapbox.com/mapbox-ios-sdk/api/