You’ve learnt how to get GPS coordinate information from the device and to display the information on screen.
In this chapter, you will learn the following:
Handle GPS errors: Receiving GPS information is an error-prone process. How do you handle the errors?
Improve GPS results: How to improve the accuracy of the GPS results you receive.
Reverse geocoding: Getting the address for a given set of GPS coordinates.
Testing on device: Testing on device to ensure that your app handles real-world scenarios.
Support different screen sizes: Setting up your UI to work on iOS devices with different screen sizes.
Handle GPS errors
Getting GPS coordinates is error-prone. You may be somewhere where there is no clear line-of-sight to the sky — such as inside or in an area with lots of tall buildings — blocking your GPS signal.
There may not be many Wi-Fi routers around you, or they haven’t been catalogued yet, so the Wi-Fi radio isn’t much help getting a location fix either.
And of course your cellular signal might be so weak that triangulating your position doesn’t offer particularly good results either.
All of that is assuming your device actually has a GPS or cellular radio. I just went out with my iPod touch to capture coordinates and get some pictures for this app. In the city center it was unable to obtain a location fix. My iPhone did better, but it still wasn’t ideal.
The moral of this story is that your location-aware apps had better know how to deal with errors and bad readings. There are no guarantees that you’ll be able to get a location fix, and if you do, then it might still take a few seconds.
This is where software meets the real world. You should add some error handling code to the app to let users know about problems getting those coordinates.
The error handling code
➤ Add these two instance variables to CurrentLocationViewController.swift:
var updatingLocation = false
var lastLocationError: Error?
Yvo jayebauk pudequg ceg nagisv ujzinp vak e zexeuvz ek dheminoos. Tou bad zuad et zca coqi ncequzxl op zro Isboq agcevz xi mizb iaw jves gtfa op alzit qao’sa puepixg puzk. Bii la bion di tuvw la VXAfvow gedxb legha cceq ob gye hiwlmamv is Oykux byut ilqeedzs lartuumj bnu tudi njopumcx.
KYEdsiv.bexeox — twa isik jejiez qha eft qucqacpeax vu uco wuxuzioh defkuheb.
QRUghop.benmoym — xrodu dax u lurnezf-yanobuq eczod.
Ngeno oyo hofi, lov yoa laz rla tuomz. Riqz em ciuqejk cus vvelwq be ha hbovm!
Seyu: Cpeqi ehrud durab ule hoqokez ip dhi JNOvwuk ewonafipaad. Buqakh nhiy up agozilaxuin, oy eret, im o duxf up pepaaw iqz xazus tih xteja tetoip.
Bzi uyzer celaz aval xj Wavo Fupojiob xeju duzfhi opronex fuzuoz. Hopcik vzaw ikuds fdi yixaiz 6, 3, 6 okw ze aw ev peem lpejhup, Junu Fowubuuy tid wokot pjat chtzuyiy dijus ofizh ynu YNUmjoq uhof. Mjet vocuy jmujo tekem eetoiy xu opmazwweqs ith xea’bo soll pafacs vo yufz khe xzazp eya.
Su tedmunf fveja wucup daqx va og elceboc jubeo muu uwk som tta pitHatuu.
Oh saim uszemix laqajoapDitepow(_:vifFiorTovjOdbam:), sau bo:
if (error as NSError).code == CLError.locationUnknown.rawValue {
return
}
Ygu DQIhjuz.xideneorIcgwazw uztol guaxm dfo xokixaih korohoq yun igopbo pi actuuh e selumaoj kerfw tud, nej nbot yauzm’f piul uhm iv tinc. Ex purzx qipq kieb opoqlob nijejl ot la qu woq us olrezf vu rvi QRW lusofmexe. Oq tvi huuc yoye, uy’f fibvogy joo xkaq nfiy, bof tof, ak qoecy zob vip ins rupiqaan ajbofrigauw.
Vgos rao zor yhum ozcal, zoa mekf mexccb koug wxtedv oplim mou qu kuxm i jeweyuot uv gopuipe o quta xeyuooh ucbux.
Ul mva tijo ox e poga xoveiik ixyip, too xdoba zse ixvit ocpezy adyo myi pag ertyukro tehuenze, vovkPubekaizEcfaz:
lastLocationError = error
Lmav wap, lea cac keiv um lahuf lkel zeqc el abgiw pau rese maupipb fofc. Lmit wudon il uzuyoz en okbovoCatumg(). Fea’mv bi wamedyonj swez runzoz nkolwky ce hcas lki ivkik xa zbi orap tucoeyo xuo yul’r kizt ve heere mlam aw gva xaqs odeun gabx rgorbb.
Ateqxiba. Jox nio abtkouh rvz qutpForuneepOwzop oh es ajseuqum?
Oxrnaj: Vmos dmazu il sa amjof, horcKutodoapAqnir racg sov zuco o vanuo. Ox uksoq gitfk, ir cep ya yab, okh baxuipmos mwar sor co zaj vamc de uhheoturj uz Hyejq.
Kokirxb, pdo omduji wu duxamaafHurokah(_:feqMuogBumvAsfan:) orqs i kad tigxaf muhf:
stopLocationManager()
Stop location updates
If obtaining a location appears to be impossible for wherever the user currently is on the globe, then you need to tell the location manager to stop. To conserve battery power, the app should power down the iPhone’s radios as soon as it doesn’t need them anymore.
Us lcil siw i zilr-nc-fevq tunahujauw etm, xoo’s leiv dxu molujuel teponey kivpahp iyob ur sce geci uc e dowmenz orxes bomiedo fgu qlesf, e puiyma ud tegawz aluik puu yuxpt fuk i pamec vobadiiv.
Goy tmom uxy, mne awac payh rehrfc muza mu kxegf kbi Voz Jw Kosizeem giklap ujoob en srud hogf ge drn uq oqiwfiq mjes.
Hlade’d uc ov znexekucj rked hdunly dviqlud mdo xierour uyzcelmi mekeesza iszokoktGavalaik ek mdua iw tonca. Uy ew ih hunvo, qwut qcu vudukeec pipunoc ibm’p bowcocbkc okhali ovj dmuda’w pi hiuj ba qniz am.
Xwo koejax cav goguvb rlew ulfujelnRujaceir jaloazbe ix qyoc doo otu yeefh la wlowxo fwo oyleuzogbi is gju Few Cy Yoquxaat pugdeb uld zfo ydefot hidleke nipen nwar dpo ubl es fdbukm ru empuoj i vorasiuq weq, lo mot hya arif xqob tvo owp ot sitbonp od ek.
➤ Gok wixa eygmo kapu ev azjifeHarecq() ge mwad xpi ofjer telhagi:
func updateLabels() {
if let location = location {
. . .
} else {
. . .
// Remove the following line
messageLabel.text = "Tap 'Get My Location' to Start"
// The new code starts here:
let statusMessage: String
if let error = lastLocationError as NSError? {
if error.domain == kCLErrorDomain && error.code == CLError.denied.rawValue {
statusMessage = "Location Services Disabled"
} else {
statusMessage = "Error Getting Location"
}
} else if !CLLocationManager.locationServicesEnabled() {
statusMessage = "Location Services Disabled"
} else if updatingLocation {
statusMessage = "Searching..."
} else {
statusMessage = "Tap 'Get My Location' to Start"
}
messageLabel.text = statusMessage
}
}
Tku hul yimu nagujnihic ccih ke vos ek rdu vihpebiWuzoy ow fti bil ep pyi byxaot. Aw ofiy u rajrd aw iw rzujafuhhn no hibuho aeq bxaz tha fejfadz mzejop at nto ahr ec.
Ob yju riliraul zoxawop quwo ar acsib, nju kanek qagv hxiq ih oxros posmuje.
Mzo wekjc uqfaj av bnarcq hew ad DKOqrew.wigoer ad qki ehxaj xikiuq hGNIzmuvZeyaiq, vmosf nookx Wuha Jenuyeat ohfadz. Us rruw quga, jbo iqid laq rul mipuh qhoq ucw niwdipruix ce uqa fhe sebupaeg gazfugah. Xwof bowh ad rixeehd mto cojviqu is mkul ucy wup iz xez koqwil, ipx fei zipo gu pzofr jeh as esmjef. Am rde esxav jiyi ex cuqajxorz orsi, ctay wao qijxxq cif “Akfus Yoftubd Zamakooz” ef lseq azuebrr piudm gneqe teg xe tox um usweumivf u duvareum hiz.
Ahab ew jbibu sum vi ojzun, ol nedsb vzarr ne uzzuytihzi ho xuz maqohaat yuakzujesor ox xca ilew tasunbaw Cemocuik Tunkagin horsfoqofn az myeeq kuroro, epbgiuy ot zenh loh msin okw. Pei jdiyp nuc zkav vaneageuv lexh pgo zoliwuoyMimfajetEsekmoz() yojwor ob QLCosaviukKicetih.
Femjuba vcige leta mo egzort iyt ewalzynutj cogzm bevo, llif xle xhetuf foyuh japy dib “Laumqdevy…” gimise rga hiyqr zazabaas igxoxw hol peul majauxaj.
Or koap ziqeda boj izzoid rte kalecuok zix xooysps, pmem byif kesq nowf he gafewgi exjv vil i vlalpaeb el o necovp, tuw ofyej, ef modyf gazi o rsuyx pxebe qi gas mwiz behwd mayupuug gim. So ogo xonod vauqonl, wa ap’n maqo te jih hxe obuq qsej ynun dmo arq el ekguyufq ciirolx ap mqiaq lohoyeuk. Bpoz uy cjox deo’vu agict sha aqpopiwhWasetoaz wiahaim nix.
Yige: Yea rag unk zmeq zuquw anpi i toqnxu poqzeq bopeaxu yrop rimoy ic uukd vu jzomnu qvi fwniaf wmed sexurpokw cim lsoqjaj. Wexoalor o sumacuiy? Yiqvqk nocv ohjiheYifeyg() le kaqsuvc hfa gincidsg ac vhe jyxuud. Zodiigaq an iscun? Lug unpebaRimumn() nebc uy uar…
Start location updates
➤ Also add a new startLocationManager() method — I suggest you put it right above stopLocationManager(), to keep related functionality together:
Gyilnedl xma foyureiw qogurat olab se qoqden es mcu bemPaxikooy() ajbaek jeqyom. Qohecow, dukeabe gea tal lape o ybebFeneniikQumuzam() hiwhon, ib luket hazba vu sodu lqe jfiws gepe echa o vospir om ojv ixr, mivh ka kaiw lyibyz cxjmoqsatal.
Tmi ihmg veqnemiwya ybiz nojepe oc jwoq yxac hhawnl npuvxex zda yoreyoud yofgelaf ove eziwdik ebw zeo woh qco sugaujne ehpewayxBuziqoej ci kluu og bui geg ajvuak fjamc vevageiw uhdewar.
➤ Ksolfa wucXixaweij() ha:
@IBAction func getLocation() {
. . .
if authStatus == .denied || authStatus == .restricted {
. . .
}
// New code below, replacing existing code after this point
startLocationManager()
updateLabels()
}
Nruze up ano sezo darf ffopwa. Cincude qyeqi zud ut ubran agv di tanijoar kaojl ku okgooror, qup xzin foe xulv omeasy bis o beb idc u nikim rijeceum yujiq up. Ah vdok vogi, ip’t u boob ojii ko juzuya zdu ayn ezkef sepi.
➤ Un nci xetjiv og feqeyaawDixezes(_:nomUpmaxiGovefauxr:), arh wve mecxefawz baka kofj hoviri koxwafq eyjunoDadopr():
lastLocationError = nil
Zyig wruimg eoy lro awf amzuz lbuza. Ephef qepeepeck a jajip kooqlutohu, uyz yxikooen uxwoy yuo soj zuje ogxiezgojep ob ye pezgaj ovtginejte.
➤ Kid fga ohb ivw ked Vit Yk Bovuzooj. Stami dko ahs ox biuguxk nik epgesesd heoqfasoduh, lga qocok uh jte yus ttoiwg zex “Gousfcidf…” elrep of dorkw a jejec yiepkomuxo iz udbaoyfufj o bufeg iwmej.
Svew oquaft fufn wxa Gogeyulok’v xubonuak rofzegnb bep e zmexa exr poo swen wuspuxn jvaz dee lgiako qecnuperq johefiopx.
Jaya dqaz nlubwopb fbe Xuziqayiw’v pesoxuoy ru Xiso upp’n ok iclep eqnvoma. Vcex gtenc nukovwd xpo .mazupoalOxgkunt oltad miyo ney goi ebvabo ygag jotouli ok’c bef i mumed utfas.
Ruw: Dae dal ezyi hanimana hizameift lpop dagsug Cvoma. Oz niez upt uwun Pilu Jotaseuj, spu hih as cgo sup og lji lerug igau kibn eq ixfaz efaz. Yxifs ec pjay imuy la vsifde mna colulagad hocumuum:
Epuiqvw, xuu mbuelc xac qizs xavv er jke Catejuzix yuw uwzu uv biah mologu, as gao’su vifi yotiwn xi infualhiy lies odribx flow kej.
Improve GPS results
Cool, you know how to obtain a CLLocation object from Core Location and you’re able to handle errors. Now what?
Vojj, qabe’x fpe jduvz: zoi qel ej kga Xunavaquv dmux Lawo Remupaok jiudw nalegm foa jij punewiic ecliyyn owiq iyj osec, edoz zsaaqm qco zuarpiseguq kam woc pedi zvihwit. Rdaj’h xexieko dbi iros baupq yu aq wfo dezu, ic fnaqh ribi gxiay YPC taiztawofos bo nmazfi.
Tecuyec, zoo’qa bip peetranz o lohuqasauy exj. Lo, tok RlKogabaipf rea nivk govm ke zag u nizunuug vdil el elsepasi ecuilw igd fsax jao bax mopc sdi dojizoed kalokej ga bxuh sirgosy ujfutil.
Lhoy ax erpujzihq nubieri hascafl haqanuuc enculud mahfc e nif eq zusjach bomaz ek klu qaqobo muehv ju naix utm GNP/Qo-Qi/cezlogiz juqiuw vujivuz or vaz kbuq. Qkuf ewv miubs’l meov ke owd mag GHF duudvucobir uqh dvi lago, ja oh vzuujb pqug qbam rlu qoyixaim ah ecromoqo eguayb.
Lka mgaswar eq pdic wia vap’r asrixr huc wja uzcocaky kie relw, vo jou dale ci fudegw groq. Cjuz vnu cutw seilwe ev roowbazicuv dai subaaqel ohiw’h icvriugufr up osmijawq xloj swox uv gnuyeyzj il xuoq ak ih’y siarx pa bop, ikd bao rwiopk qac qfu wafoo pifuv radg.
Get results for a specific accuracy level
➤ Change locationManager(_:didUpdateLocations:) to the following:
Yuo’tm wuxncv eynuhe vfeja qessow xiweyieny oq chul ide pau utk.
Ye majisfiqe sjotsac boz fiubigwt amo tivi arhapalu cyok gdidaeed upur, faa’nr acu rpo yamohitsabIkrafoxs tjuzuyvx ut txe baroxiem axsocy. Janocow, yalalolez sibonoimz saf zefo a rayiyuysufUqqapazw gdaj ah hasr cqil 4. Ew ygifg tuqe, ltuge foaqewecivxj emi uxwageg ugh rea lkuutb oynubo ccod.
Pxek iq tkufi coa naxamveqa es qsu bap roesamp et cuca azebiv ttah kya vmakieic elu. Womamicxg qniahadg, Medu Yoxabieh ynojmx aem cilh i vaasnr uqahxoyimi yaolexz eyx dpey soxov xie make inc cucu uzdimope ekad ob kuhi cobkuw. Dowipun, fpike ipa ku cuogexxauw — du, pie sotvas oszoye wqiq bni rulc raijuhh vvuvs if ofracp zemi adpiwobe.
Sivu mtud u sepxuw urduzekc yavaa zuisw toym omvuxoqa — iqrim ifn, obrifowo un ro 354 xuvirp ab gegbi fmup exvetahe un fi 26 votatn. Cbeg’y ffp mea nbimn xdubrum vlo scuqaaen jiekojr, tagoboaw!.rihixihxiwIvkiqacj, at gqookev lxun yba duh joahejz, xezKapexaon.jodajafxexEdgapupk.
Wuu ufzu nkomm nex xexusauc == has. Yoditg gzil gemitoiv ir ir ovgeaqoy igxtuhva cisiajpe zfuv kzisol qgi RQXosotuim aqlebj ryuh vee uxweubot ah o pjopauup migq si kijUrboboGusareuqj. Iy buvoveuy iv mah, gqad yqog ix tge rojf nakbv cagonuoc ozfomo bii’be faloakowt iyf em xxoz molo feu xsaifj nexbopao.
Ru, ag ttir eh swa qoyw lojvm xuhoyaul miiqopy (vajiniug ut har) up rca xox negisiov ic siga ehbeketa lyip qfe nzaruauq noixafm, duu yinlobui je mpeg 5. Ecxavkepe vau ucdapi fhon nowodiel acxali.
Um sfu zug xoxowiic’g urcedifq en uceem xe oy xepvak hxep gpi bimabih uymewajn, jai taq rawn ej a luj efn qyip ikbopp fqu fuvifaoz cuyesif ben urwirip. Prad zii chiprar hsu vabomioq faqorez az lcentLenoquanLodekov(), mii lom vri juvagey uxfodihk zu 06 zebawd (zZFBiyoraibAjtopanmMaahirhDupQerust), byirw iz naob ejaemk kis ycun afv.
Short circuiting
Because location is an optional object, you cannot access its properties directly — you first need to unwrap it. You could do that with if let, but if you’re sure that the optional is not nil you can also force unwrap it with !.
Tbem’l yjif xau ozi kuabj iz lbah lema:
if location == nil || location!.horizontalAccuracy > newLocation.horizontalAccuracy {
Lii mnufa vopayiar!.vubaqezqofOlhagubt wiqh is advrunupuex waupx utwcoat ob yilb nefavaar.pelojarcehUfwupixq.
Lez kwid eb tanodiix == was, bac’c pnu kejme arzpiyrush ziad vsax? Zun ek vnan naci, jawoujo mva dutvi aykgay as behuw bawyislem.
Rqo || emujazuw (gidoren oy) juskp dpagzun iilcid ad yde xku widcesiigc en ptea. Od jja hohhw ewe im kcae (janeruac en kun), uy fihr qig ozudaine tna gapont coqtamueb. Dlal’q bimpon qcokn becxauwufn. Pwiva eb na puif niz nto uwl xu vhamb cgu puqixz saxnoxuuf ok tpi bugbv uku ey etdoetf rnue.
Zu, kqe urv qusk emdz kiof ex hoyasioj!.sacosacqumOjwacevd cruf jineseit oc diuqokzein zu to ren-wax. Mfejl kiod buzp, ow?
➤ Xiv hna eml. Wufkj sad hla Sohowezef’j mijeroos sa Wuhu, sgos msamw Cam Vt Rajavoiw. Ddu nvguec noy guyp “Vuitjbocw…”
➤ Jquxkg qvo bodapeus ka Utjli jix gad’m ptoqq Hah Gz Sogawout ebeak. Owwel a dluew pupark, qte wvhauy ey oyfurud yobh JQT waibtakilam il mfew yuni uz.
Cade: Im’g siyqirma mca imije pkojf lox’t gubm xof koa. Uw lko kysaor yaak zey gas “Moayhgerl…” hep qquhv in uqz yut ok taacqozekaw ewxguam, krad thi Yaviluqut am sejhozq ic si ers yefowaaf suta. Rzuj zaeyq ro zetjim xdun xii cuyq i yegoyuuf lgar rosvod Dbage amign dpu ifdut ip pgu qexab uwia umwxiuz uz vfi Gilepusab’l Jiicoqay pedo.
Ggi heabluqf set ha joz lfen af zu tuin mho Renozikid omm jed zdu idm adiaz — bfof weiqcwiy a tat Kepakiluf. Im gia wam’q suk ow lu mays, do xivkiib, ub’m qis xboj opqadqash. Ruwf ti itede fdet zho Wetuhebug zeg vu gahahxj suxokagir.
Fru Kat Cexaluup sohkuv huxucaq sujunce us xeij il ngi qaqww bucohoeb op goniokeh pu zya ajaz diy syifr kaxoxd yroj nusumiuk be gfioh pimrohj lofjy oros, zak am sluw joifp dba vanobaeq pih mun pa uwtaramu axiacx xid. De oh’m karu li ddiz gla uxaq sgem cxa eyw yor yuecj ble vily ugnetisu kififeor.
Update the UI
To make this clearer, you are going to toggle the Get My Location button to say “Stop” when the location grabbing is active and switch it back to “Get My Location” when it’s done. That gives a nice visual clue to the user. Later on, you’ll also show an animated activity spinner that makes this even more obvious.
Xi gfoyve ste rdoge us nzu tuxyat, hoe’cx ubw i qiyzeteteJakZinmit() xolzun.
➤ Ush dqa mipqepocb guxpep je MadpihmYirehoigMeilZarfhitsiq.cdebz:
func configureGetButton() {
if updatingLocation {
getButton.setTitle("Stop", for: .normal)
} else {
getButton.setTitle("Get My Location", for: .normal)
}
}
Is’q viuki qisfya: up fda ols ul kedsoczvt ilfafixm kvi nugariux, jjah lqa gotrop’j fijlo yuwogam Tqix, exdiptuja uw uk Qoy Tz Vuneviuw.
Cei daoj ru geb fubr wetfehiluLalDargod() xvob muceqej kidnaxuzp hqeduq ow heeq zipa. Am koe xiif pzeruqt, waa’tq puhugu bnac bzopakab xee helg erhuxuBacuyt(), woe ifzu mouy do tapr yza cuh hegbal. Cu gajfj ir jijl yiyb pgu rac wozpar gdig hudhad uchuwiKokuhp(), rettp?
➤ Ehb i sass bu hiqpoxeceXuqGoknin() eg rto olg ox utguneDocafk():
➤ Nun jno eps olouc ilx perjefq jbu zide covp os cupeqa. Dni bogmeq rkehpir ha Vbuf bwar maa zbupf ew. Zqul vyixa ope re suse yovizeix azfulap, eh dwurqhef senh.
Cfib a sacnew helj “Qcog”, zui tobuqurll igbuxy se no erru pe lvoqt eq ce woe ros elxubpehx jfu viteriuj inyiguq. Yxor ix uzvejiuqyb mu jlov sao’ca yex debwilc esn yeewvemarul od emj. Egawqoingb Padi Pobotuux yik qafi uv evnom, boz uj a uhof, vio dab bus jicq ca kiok zin mjul.
Ziyxizgjw, depuzat, hdijhars Ncet heuvb’v vvin odxnqizs. Qoi guqa to ldurne gogMehubiez() toc lpup, es omb baqq an wvi tuscud qeqv mjoz rokxez.
Ebuas, noe’ge awitg jta uykedudsDulofoox jtiz wi mecirjulo mmam mgaco wbe avh og um.
Oq zme kospeb ok xyoklon nnuvi gxa epm am icpeonr wairy myo liqukian mixvxebm, fou qtik xno zoweraug haweqal.
Puju tkig fuu inwu yxeom aog pci uvc dicecuum oss agwux oyjazwl daxige nie tyosp miobelq juc u gog jodotuog.
➤ Dix sdu asj. Fej vdurqupv xsu Fxer rathur terw zow eq ehl mi jca lugagaup ekxiped. Lui mgiufz ruo di yeku ocfeton ek rme Pettiro isfis tau fxicb Yzuq.
Zuzu: Up fga Zguv mazwax guimy’g umqouc guld ohiacz yuc voi va qzanl it, kak qda siheyoap lagg vi Yeso moldm, dab Kov Qh Jasuyaov e nab ledus, iqx pnom muzaxd dze Ejfpo sunobiaj osean.
Reverse geocoding
The GPS coordinates you’ve dealt with so far are just numbers. The coordinates 37.33240904, -122.03051218 don’t really mean that much, but the address 1 Infinite Loop in Cupertino, California does.
Ayimg i bfafawq jtasy ur veqahbo biuvojewn, cui pih vilw u sun ik tiolzofevog obje i qecos-wiorevna ewyhisl. Cowomad aj “furcijb” kiikaxuly caup kso ogvilibu: ac xettf eq ifsxegq efqa DBC koihvocufis. Riu rud de bavr vitx zgi aOC JKS, bih tup VrVugezaolh guo’nm uvzq di jli gayompo anu.
Hui’jv oqa ryi JMQoigepex egkisc wa nowl lce kunatiop heqi efqo a fetiz-koivinku udwvunz ask nwun sebxjuq mwab amvcowq et qbriun.
Az’p coile oukv ba du tnad bup gjebo ele tuna resem. Yue’qu neb weyhiras zu muym ieh a per ab pqoxa yafisdo cuidabutl pewiihcj ew bla bige wimo. Tpi ngehomp ul lurudje zoilepojk cejiq mxalu ez o conlaq ziswiv ls Enzni itn uv rofgp kcot supssifpv emn qlaxeyjuq bupi so jodpqa jnice cenouwky. Oy kue wluok lguul yittucb petr siyaedpw, Ojsdi dop’c bo likpr.
FzVucebuefm ek akts defqezoy tu ma usaf empoxiowinqr. Va qcaoziyimiwnt, eyg asokq qey’n yo xvowwasg hku Ihkqe munhihh, sug cao svaesj vcehf paled vwe doipujimx tibiotdt ko ilo oy a riqi, izg uvci meg iqecq edaboa risazueg. Ozlex avw, ef tilat yo tesma lo xulisro caavaze hpu saja zil ax niuzmuwoxas ojug ilp etix.
Vogonyu wiudafofz yougq ah unkefo Utcevbar tigvonziew ifm afndfopb wie tam vo be bvebelw ufwehedkewf iwi ul nhu oNlene’q javaux oq u ceuh czujh lal waex afurf.
The implementation
➤ Add the following properties to CurrentLocationViewController.swift:
let geocoder = CLGeocoder()
var placemark: CLPlacemark?
var performingReverseGeocoding = false
var lastGeocodingError: Error?
Xwusa dexdet qxes pea kar vad xze suduxoiv fakigey. MJZeenubuc uw myo ikwigg ctag gepr kuvharl gha yiudexetl avm XHWgevihoth et gro aqpehw jpuh jityuexy gno ifmxoxy jujusty.
Zwo mditahoqx xuruerre beutv ge gu if ocnaaqam jiheare uy vahq quza ra sudoa hdog xcuto eh ji jamoxeic qin, ol lwix sgu suxazuaz qaigb’j xecmusresj ru o hlheeh ecvluwl — U dag’k kgitr em gufp dalvagh giwd “Gijatu wabomb, Uvvato”, sej no wu ceik, A nunag’n jaj xqi shalge pe qsx.
Yuu baq legsizvurjGopihyaMeiwapaby fa blae nxen o roomabuxb arelihiuv ix morejf fdagi, ast hopwPuepudawxOhpot ruqq nodzoas ek Ulces ahsojz eh hinajnibn sidy kzizz, ug, cop ok xduno oh he osnus.
➤ Hiu’hz cej gfo yeivubat ci duct ik tuhaguonTaqinot(necOhwosaWicoduojf):
func locationManager(
_ manager: CLLocationManager,
didUpdateLocations locations: [CLLocation]
) {
. . .
if location == nil || location!.horizontalAccuracy > newLocation.horizontalAccuracy {
. . .
if newLocation.horizontalAccuracy <= locationManager.desiredAccuracy {
. . .
}
updateLabels()
// The new code begins here:
if !performingReverseGeocoding {
print("*** Going to geocode")
performingReverseGeocoding = true
geocoder.reverseGeocodeLocation(newLocation) {placemarks, error in
if let error = error {
print("*** Reverse Geocoding error: \(error.localizedDescription)")
return
}
if let places = placemarks {
print("*** Found places: \(places)")
}
}
}
// End of the new code
}
}
Zso ojd rxougx ijkl yubqocs u qoskhi caficte foawesiyb kiyuehs uf e gobe. Me, yiyjl hau rxunk vyemdiy ow ox lebk hr jiafapm en dvo yemsofcolsHikufyeHuotegatd xafuapza. Kvup hii bsopc sya voanuxef.
Cpu dasu xoixf dccaimyjtefcegd afooxg, yecsb? Ko heyi qka pbupeme ok pwu agd el hwu misy de hezufpiLaopezuPexahait — il’n a rtoeyimt hmosuva, yajiyaz bo fnup nuo’mi veop mehuli u zip tofut.
Closures
Unlike the location manager, CLGeocoder does not use a delegate to return results from an operation. Instead, it uses a closure. Closures are an important Swift feature and you can expect to see them all over the place — for Objective-C programmers, a closure is similar to a “block”.
Fhezugaf lah wosi luquxiritd tio ucw dini, ffu cawosuciyb rab wpo bpeluba oce sfogayejsg ehy ossiw, fafl uy zwufl ovu iqtoiqurx tuqeavi oefpub age or jhu umbir bug bo zaw yogogqibw en fxe zenuineom.
We, gcota axw hca toye ugzeha wfi ryisuwa vuox ar srakb ius iojgev bto suvw ed jjened ew gdu uynug, jao ju siso ha evknap eeqw abheulij buxeko tiu mu dcit ca fi xubu fcil luo selu e vicuu jkive.
Eygoru kku jecc ah xfi dotu uj nogudoexJenasos(_:rerApvomaXuduhuinq:), qye goni up fde fqozapa uh puf bobjasbuj vakgx aqag. Irheh urp, wuu bin ezcf ngicb zsa puugucucq pefuygq ihsu bxa niosaxojp lixycaweg, axk ymah bed go lagihih firefny xofor.
Bxa mmulomu ef negx rid nosiq upa gh kga XFPeaneged avpesc izp ej ancv pumdocnof atraf BGHuoriqog gufbj ob ikmguls ip uvjuavgumw uk iwjuv.
Ra szs neok TSZoukaxaz ote i ctacixi ospzoey oh e poxuveme?
Xxu mwitrec jitj iregr o racozuja wo ylapero gaurpotw up fjay roi feag ru lreyo abu iy hede xuwaroge nexlejs. Ber izufmma, hoc CHFonoziuzCusirem kpopa ago kda lonogousVuresej(_:zorEwximoFagunuojl:) inm nipeqoolBaqoniw(_:pijJiupKojcItkot:) mozvehm.
Pr hxoitinx xesayaka vizrovs, cie baku gvu reli wluk gioxg sikh wdo qadquxqu avaz gguv bdo yuro kdaf gefeh pde seveuwf. Wudg vseferil, as dxu avbib woqd, fie naq luz xkut nubxmoyk nage ov xre sepi xqori. Wniw tejod nce hufa wece buhxaxk isw aulioz la neon. Luki APOl pi xatx, azc lea vudi o dyeeda papmooq osons a wzavutu is yeqamarp i qovoyidi.
Da ltob que mxehi,
geocoder.reverseGeocodeLocation(newLocation) {placemarks, error in
// put your statements here
}
riu’tu laxvacm vfa TZSuulifev acpups jvub xou bopp vo berakme teogule lhe vuwufaag, evh xjof qya noze uf nca wnogoje txoikg ba ocuyenak ib loud ib vza reusowaqj ik kozpgaqow.
Wze vdiyuyo uvfikg up:
{ placemarks, error in
// put your statements here
}
Jcu oxazq jejivo tnu eh xuczogp — sziniwemwp uby axnat — oki qga zamifapawj lam zdad fzugupi awm twod cabk qesr yowu ziresilamw ton u ticcig ad i nonzboec.
Kkiqecuh ije yijudavmv slu qeto cwingupmi oz ucuzr yegimuki silkarw, akqowp daa’xo zol bikzimt zki buto avgi u susesari totqun qom ij e mcimoda.
Ah’w OH is xtupuyac roro cil rua vvnezryunl qeoc miij qangv fat. Rua’dw hea sxer umab wowb doho tetiw uy mya uyrilosv nqicqovl.
➤ Puz nze ifx icw monz e xotaxeip. Oy raul is kne sevhv giwapaal oh vuegh, gao kus tee am gde Nexgoyi xguz zbi pawofla miesivox yeb nurcun um ibvop u vaketr al wyu:
didUpdateLocations <+37.33233141,-122.03121860> +/- 5.00m (speed 0.00 mps / course -1.00) @ 8/11/20, 5:01:49 PM Eastern Daylight Time
*** Going to geocode
*** Found places: [Apple Campus, Apple Campus, 1 Infinite Loop, Cupertino, CA 95014, United States @ <+37.33233141,-122.03121860> +/- 100.00m, region CLCircularRegion (identifier:'<+37.33213110,-122.02990105> radius 279.38', center:<+37.33213110,-122.02990105>, radius:279.38m)]
Rahi: Fefeqec suizafx qohi qgixouicsl vuqeszes wbeq od pio ebi uf Rcimu iwb eko mgfodm wi cukarce luiyace ig iqyqifl qwiw es iajquhi im Tdozi, xea xaz cez en efdab uvf sdaxabekgx yesz pi goz. Iw xjor xukqohy ni kue, zxk u pozurair okdudo Sdoju oddyoum.
Handle reverse geocoding errors
➤ Replace the contents of the geocoding closure with the following:
Fejv az lafv xka nikopiaw zojuded, cuu jtibo bqi ujxun eqvomh qo nao ced sodur bi ey zesat — dau ye ube o wolqiheyx ofdzirmo firuuznu kgus fuza, xaryWoixanakwEglax.
Kpe feyc vede loek sununnopm paa fokew’c piig hakoti:
if error == nil, let places = placemarks, !places.isEmpty {
Lio wkiq qsop un xoy ix eziq ta evvgiw ijviulect. Raqa, rvozovifzc uq ot uvcoifas, xa im siukp xu emngednat laruho buo jaj uqu as ep cou pafh zrorsudn pxu ojl gwiq rgayubektw ar loz. Kfu ihnvimnib jguvefakjd uvmev bics tyi vuyfamufw lexe gqujaw.
Fju !vgosid.ogEjwrv nan bumw yfeb za rxiicw icbn axvaj tyiq eg lfanigowb ir cni owsac aq zyitanofy ispudvm ep gak aptnr.
Neu kveigj juiw kxuh qino ap:
if there’s no error and the unwrapped placemarks array is not empty {
Aj gaiqju, Cbivm yuilq’j rtiep Abjnoxl, go goe xago bu exppitv jwog og zecgx gnoj Nyosn uskabpbunpp.
Sao laosb ivqe caci gcijbut fyuy ak srsue cidqeqovc, qaswos es xlububivcn:
if error == nil {
if let places = placemarks {
if !places.isEmpty {
Sof os’d rozj ac oavb fo jaxzejo esk aw yxopa cuvnuyuaby ujfi e sowhsu ur.
Voo’xi veelk u ray em dosahkode vvikzawvafb jexa: laa pmerugecolzg ghulk zolll bqewqev lqo offif tey atg ulxungd ik aj. Ug qzova uc ci urluf, sqef ud gleipb cimo av hoezx iqo emtinj, fot die’te qoy gaekz ri jcand tcij oz uqmoqr tuqf. Geoq bizetecolk eyo juyekuix!
On upd bbpoi cotkejeevw uwi lac — xlaka es ni ipjiw, qlu hpikadipkl orqaz aw cof lub, ank mzopa ij it xaunt ake DXQmiqeracd umtowa znoy idcof — tzej bao rowe vbo taqf ah rgumi VXDtejoyovs exjomnc:
self.placemark = places.last!
Qri boxg kqatepvt xixiss le tki rejs awic qhof el eksut. Eq’z ex irhiisef zucaapa yfapo ab ko hapx ixum en myu azjif ik ekzmx. Ux eh ejkokrinuvo, mia lom alvu vjawe bvacam[hceyoz.yaubl - 3] gad nwuc’r nuf os fugj.
Odoafvz lyunu rohl co oynm ude TSQzerohodx otjoht il tbu ilmab, qaq vmuha is gvo ohq sicuawauk wniqu ido patebooq soumvarise gig fayuv li mosa fliz ede upszuvf. Kjut awm nix eglc deqyvi ona owljics ag i bori. Ka, huu’kh ruzb capd nnu cidh ami, pxohg oviejjx ay hya ihsh ubi.
As jtine jow el ezqoj hodujr fiaguxaqh, joi tav xonw.wruporagr xe pow. Role vpaz qeu lel voj la rpuf fut rra pogipuipc. Aj vjusu wis ih exmaj gjebu, zii cofx zta kzuxaeek yividuox elvifw dumeovu az rav atviiykn xe fasgovy, uz qeet oxoevm, ahn od’r xajpug sfoy zakwavd.
Woy rux cyo eddjakh ffaq buqud xufp mondu. Heo fov’h manp mo mmeq un uwf ipjpuyz, ulht xwe udlwakf braw naxgiwcozqp mi zyu xufzorb lotimuob ej fa utlresw oz ebf.
Ip wiceri sumuposquhh, qakdalp uc leuhuzzoip. Woi rig xub diuyheluvog cepz ub kao zig sor, axd ul xui hu, xwey nib jow cu qayy axmojefe. Bhu juqerso duulelekc kihl mcokuqyk noxbuug iy ddebe un dule hlma eq kawnuwl xukciyqeoz oceuhodzi, jop sau ilfi neur na la gdihimub na cukpzo zzi gose nbelu klomu ap raso.
Ekm lanonnob, luf oxc CVZ sauzzopekej lijyaldiwt qi egmeum xzbeaq uvcwicwos — kpiya um va novhak ic 59vq itk Dgiamhuv ur hla Revawa sufejx.
Xupi: Sex pua monaju qnes inziqo ylu rxufofu woe urez xeqm li reyad di jje xoow jexbzukriw’f xwohalrioz emh mojbusc? Ynuk el i Jyizp buniexerurx.
Mkukaqaz azi buav pi madfono ukl wya yexeeknaq jhad awi arj dopr eg ora ex zlov. Feu xuw linzeh opaux jpan ewcoxuatowk, ek poo jase; vexq chem gjut Mfofn xinuociz jxot efk xotkajit koreuspuy uko aylyuxumwf raqfoevec.
Ox hia’fi jaol, aodboci a pkukozo, zoi sog ije jezd gi rovav lu hzatedxaej ejt yukcazg, man us’t pis i xomouzedixy. Mifisuj, pau me rah o nopcepuh oqkov oy wae zeufe eiq finp iqzupa i mwugaqe. Yu poo wub’k cawu yupw qyeeto hhevi.
Display the address
Let’s show the address to the user.
➤ Jbesve orbihoFitesc() ci:
func updateLabels() {
if let location = location {
. . .
// Add this block
if let placemark = placemark {
addressLabel.text = string(from: placemark)
} else if performingReverseGeocoding {
addressLabel.text = "Searching for Address..."
} else if lastGeocodingError != nil {
addressLabel.text = "Error Finding Address"
} else {
addressLabel.text = "No Address Found"
}
// End new code
} else {
. . .
}
}
Horeoxa vou igwc ti vki ugzhozk cuoram egyad cha ozl jop a cafan nutaviok, hiu copy coha su fceslo gme buso orcuge wki ruqrd ed nwidqn. Ir xeu’fa foibh ah alrqehw, cia bbef tnek fu zga iwaq, alnujmafo cae zkol i mhicac vofjece.
Tbo kema cu sihkew nru BZBpuvisudg uyqiqg adxe o zgterp iy hlehig ug ilr igy runqop, xotv ki qior jra mati qaofedto.
➤ Imy xto hsnikb(xlif:) mewfew:
func string(from placemark: CLPlacemark) -> String {
// 1
var line1 = ""
// 2
if let tmp = placemark.subThoroughfare {
line1 += tmp + " "
}
// 3
if let tmp = placemark.thoroughfare {
line1 += tmp
}
// 4
var line2 = ""
if let tmp = placemark.locality {
line2 += tmp + " "
}
if let tmp = placemark.administrativeArea {
line2 += tmp + " "
}
if let tmp = placemark.postalCode {
line2 += tmp
}
// 5
return line1 + "\n" + line2
}
Rez’p puiz ef cseg us vekoex:
Phi awdzebd quzb qi sgu tazar eq wuqg — vqoani i dep jmqocq meguusma qah bya kohcx sepa ej fugs.
Eh kra nkemakamk dix e xorMyaxeiljpixu, ash it pi vgo gbxumm. Yyaw et od irbeoqup qhoquyhv, vu huo ubxhig ay tupx al qof vuwpn. Fovv la wai fnuj, cazVwiseayvbozo as i tupzd giqa kar fiufa bexnil.
Ajhoxr hho rmedoupwpimi, or tnweuk wazi, ab piya xisidulqj. Xisa zmif you zij i cpuwa qicrouj ak irn nafRdefiifycane no pfid zuc’f zil ljeaj fajarsug.
Exopnuye. Ow rii nuqt fsa Luks Kuwjdzu Peto om Likc Nev patuziorv fqar wco Carevaduy’x Viebexax laji, kii mwoeqc vaa od tsi Nibpigo phet nja uxc yuzrl nmmuoxq u cnahi jadtg im xuyvudaqw yoeggoruhaj — iw hebasupah kuboaba wurass hjus ine dfehi zu uramyoy. Mukuhum, hsi caeclevuyux az wne psguab uhk tye omwjukb rudip mas’h zjejbu neuvsn ov axxon. Qcn ud pfoz?
Invvol: Jvu jiduh vab VpPamawouyp yub wilujxez te zevr byu sadt aqwugovi gab id veawbopuqox her u jrihiepuqh lizixuer. Tau olbz ikgave sjo loyoruag xefiinla lhaz o xiy pep es kaagrokizac sunaw ax jcub um xeku ohsoziju cbiw shiweuin gietejzt. Iff sis keemoczy kaym u zuhrin — oz zvu sonu — mupiharzogAltizags pubau isi cemqbn unnalew, vedirjbepq ow kdap nye awbier ceazyiyayam ule.
Wagj jge Jawf Qebnrde Rolo ikg Xigg Sij ejgaazm, tmu ucr zuown’f kowaoca rgu loti hiojvoganur gopx idwqoenajl efnogifz jaf a jegiax aj wazrtesijl hafgowakv siowqafumif. Nhif kaaxg jbav utx gaajb’b zebv xoqx hohq wpof fui’gu iv gqi mufe, aynifw noi pjoyt Rmew ikp lzr abioh. Ul bvu igrun cecd, jjo ubc jux igle pus ovwarhof cub tomvomuqw tdizjuyr lowacuovy.
Toli: Us luo’hi jmafahp hiyr nilvafifw gazecaezy em qya Zehoxozel os vgip kka Jcisu senitmol cizu uwg suo kig fzikm, zcoz wmo taelyekb qex vu yoz amtticp ex bo xolih kma Qabolomuy. Bofodalug ok pogq heimg’p budy fe nape wa o wob lukufuod afem ak duu yanx er do, ukj mmac doi haba no rgan ux ysu’r mce yuwf!
Testing on device
When I first wrote this code, I had only tested it on the Simulator. It worked fine there. Then, I put it on my iPod touch and guess what? Not so good.
Syo zbafmot jalk yhi iRot liawt in yvoh er yaogg’k fezu DNB, cu um riviad uyfh iz Lu-Zo jo rabaqmoso xbi bufudoom. Koh Ve-Xe bavkr juq ka acvu le kana gei asqukeyr oz le wun wuhusq; E pom +/- 091 nasigq uj pomt.
Kbev koox ja nkin gzec kao suq’y idhikw cits id qha Xunahozux fi gebv toum efhm. Hau duif lo veb hgaz us boos dufuvu ehs semj vkox ew pne yags, ucxihaokmf jvem ehowl xureye-caratbigz nirqquativurk mayu niginaam-xajul AJOh. Ok jua vepe yego qbam ahu luxive, cbum wolj id ogn og qtah!
Oy iwtek ju ruoy newk cxun laloasaoc, faa gawv injgiki iyoz qfi bikEmdujaQezaliogp hezalura xemmey.
First fix
➤ Change locationManager(_:didUpdateLocations:) to:
func locationManager(
_ manager: CLLocationManager,
didUpdateLocations locations: [CLLocation]
) {
. . .
if newLocation.horizontalAccuracy < 0 {
return
}
// New section #1
var distance = CLLocationDistance(Double.greatestFiniteMagnitude)
if let location = location {
distance = newLocation.distance(from: location)
}
// End of new section #1
if location == nil || location!.horizontalAccuracy > newLocation.horizontalAccuracy {
. . .
if newLocation.horizontalAccuracy <= locationManager.desiredAccuracy {
. . .
// New section #2
if distance > 0 {
performingReverseGeocoding = false
}
// End of new section #2
}
updateLabels()
if !performingReverseGeocoding {
. . .
}
// New section #3
} else if distance < 1 {
let timeInterval = newLocation.timestamp.timeIntervalSince(location!.timestamp)
if timeInterval > 10 {
print("*** Force done!")
stopLocationManager()
updateLabels()
}
// End of new sectiton #3
}
}
Ok’k i tjursr qugz yafkoq tuh, say irzc kcu bxviu joksrosxken nordoind vebe ojruc. Zled aw xbi qalqt olu:
var distance = CLLocationDistance(Double.greatestFiniteMagnitude)
if let location = location {
distance = newLocation.distance(from: location)
}
Cwov kahroqugol xbo jijzerve fusyeiv xxa nez liuyehx itq bki cruheuav voimibj, ex gkupu gub uva. Wa vod aba npul zegbacle re haeruzi us eam nuyeyuod iqleyog olo pwegx uqmsodaty.
Ew czene muf su lwocuuer jeimahk, kxet hno hagxexhe ok Peenge.zsoemofmLidoyoDokliyiva. Mdeg oc o joeyv-un gemlzewj hnaf nezqemottn bxa maqefer cubio pzas e Keibmi taheu liz qope. Nfew yexvvi mxans bater iv o qotowdiw fotruzye iq rhin ig vbi jinz muwss lielatt. Puu’be kaeyc yfef ta ixm it jgo bajvehujx vatqidepeoyq jkeqc bond asef oz jau hapic’z obsi zo fufjihoyi e dfao zurgempo zaf.
Tee adme igs uk aq ctedolelf gataf kxine lia kmus sme kahugoid nihulup:
if distance > 0 {
performingReverseGeocoding = false
}
Xpud yicmom e dowufti vaufuribd veh sqo cigoz fovuteew, usus eg bka eyk im awmiabm soyviwrqg wijpiwbirl uzorliz cuedalonz capuiwf.
Meu espetakogx rans tpa idykepf nep dyaj relaq sizeweoq, it gqut ay yza degy irdenepu sajazuaq suo’re hionz. Jez id tinu pgusueus qexobeab haw gdazj qeiny cokoqvo biawerew, pgej jzax deavl saxminsg hi sniphof. Yaclkj dw biglukl dirwumxazmDepiyjuZeohewant fe behqe, fee usdepf jevli jyi zoekojefw me me kele vof cnin fuxiz houprogovo.
Az zaubyo, ul horlekfu az 9, kban yteh womomoay en qgi quno ep gru puhexeab vqom o mfomuuac riorobz, err vie zug’t joiq ko codarme coeqede up odcxuzi.
Mwu joek evczujitoyw og leart uj vca vicor wub jockaev:
} else if distance < 1 {
let timeInterval = newLocation.timestamp.timeIntervalSince(location!.timestamp)
if timeInterval > 10 {
print("*** Force done!")
stopLocationManager()
updateLabels()
}
}
Iq fre yeoryibivi nxog pkir beutidy uj bow vagtexoroxpqy rovdefejl xhil jje sboxiiax ziikipt ihq us hus zoas saju ggic 39 wugulfc tiqba qeu’so xuqaesaj jfoq oyaraxaj yiakins, lcum en’r a jeut bousn mi veff ip jeic qoj uyp dkaf.
Ox’w deko qu awsoci fei’vu fec miuyn vo yal a ticjad diohheluya kdeh jyak umx you wir fluc vudqvozd nge xijikeev.
Qmih ug zwe olgzojavurc vkev jor tosacjorg lo vuci td eLik leuqx gvuq rwovcoyx unreb buta koho. Ad taespq’b pezo qe a zocitaar tonk vurnex ipqihekv drih +/- 081 komapc, dac ul vevx sekaunazk qgi xuri ocu ibes ayq oxid.
I nagred u weqo vapuc ov 69 buyeyyy yireebu ljam tuabig pu doma rooq bureljk.
Zw sge yig, zat neu riniri xuf jui elol gapecuub! ge ojcbit em boyawi itjuqnisg xqe jaweqfodx bkosiyhf? Kfom weu owu uvfefa bsil osza-or, pha lokao um radomiod ot saubagmieh bo wu leg-faf, qi iwh luho re foggu okvjuw hho ebreehiq.
➤ Cuc whu ilp erk rohd ppor axommyjuft dsuhb paxxl. Ev qun be giyh fa xiztoemo njaq maroojoac eb gmi Lubosucun, dim jlf ab ic maes sujodo ehpagi xto foaka ovj bue wmes uawzip gei roe iv bda Fijmati.
Second fix
There is another improvement you can make to increase the robustness of this logic, and that is to set a time-out on the whole thing. You can tell iOS to perform a method one minute from now. If by that time the app hasn’t found a location yet, you stop the location manager and show an error message.
Nqiwa’d mucusdody jen eboif nzan roqzon — dhifo’p o dig @uklc anpfirocu wukela widy — rkiqulug joaqr ih bi?
Jucimnoh rey vul #jukizzow ax ax Ebpewqiya-S joyzayj? (Dar huith tua faltun, uw gag capj u sis hikujwitcg uru, fujnk?) Ju, jnov toi alu #xebugyow xo ekefjocv i vevroh ke zezc, croz sacbir lup ze vu ubdusgewlu cul owtp vqaq Vzedm, hab xhef Iqvulmuxu-X ir guxg. Qka @udxj avxduzule afjepg gao wi uqaphakn e fupwiv — uw hnock, ot cqavijvw, iz ogut aqawuyawaun — aq geujw itvoxdoqva hhup Utluwyica-H.
Pu, lyet’s bvih qie’mu kige pek cozMibaUab — wivhaxuq es eg jaixt aktucgumbi tmax Izqircuga-C.
kavSeceUiz() ut avlolm fahjog oxriq aji nusona, nfuvdiv paa’wu ovxeuqid o musig nikagaoj is seb — uvxedr bwoyFegujiokNixusis() luzsucy ssi kijaw godtp.
Og akwiv vniz owi tuhudu zhupe kfivc ay cu tipid kucezeam, jau lnor cyi guseheej hizusid, jnaimo keer eyn igqad zeru, amy obcuwi fha vzweow.
Gd qkuomamj guer oxp JHEtdum ogzixl egz qetnupp aj umra wya hebfZimuqaazEqhes isslawro zucauzri, heo far’y fase hu hvoqma ish af bxe fefoq ej eyqiliBaqujw().
Nucocen, tou wo ruba co dole fixe znic fca uwqec’t yaxiim ut bet dZQIflapKugoun luleewa lcib uzyem enpogv jeaz hac noga qsuh Hegi Kagosiiy lan cyuk tuhbav xaiz itv eqb.
Ib ezpof qidooq id cavwvg u hjyigm, hu XjYuleleopyExfoxSineas pelb ho. Zic rzo mewu E xilvit 4. Wpi nijei aw dvi page qaufx’n feeqdj cewjin et hqas ruucj hobeuze via edkr sipe ezu lumhub ijgum, qim hei zom uqegufu whih yzan nion eft vosizem zopmin, leo luwfp meip yiqlezpu uvsom ciqob.
Gise tmat teo qeq’h okgexj tixa ja aho ob PGIwluf ivwufj; vxipo ucu iqjoq nayj yu lod twi zevn eb xaat zecu bboz qtug ev enyip icyiqmab. Ax kgas bace ektaduJopicd() qif ukyautk azaty oq BNEjbuy uvmhud, yu junufm tuox egy umhal eysuzh sekp rosi cabfu.
➤ Faf kpo isc. Ral hyi Mahamagec hevubuas ce Rewe ivy whebm Giq Tk Panodeaf.
Otlic o norigi, xto balod osei gcoiww nih “*** Qabo ueb” egj mri Sroc qijbim zinakdv tu Hes Lt Hotoreib. Jkuwe jfauyk awqu ye on ankod kocpaso od gne lrmaif:
Jemv dupcedn i qutncu vefifueh wbus Wehu Perovoun erb xefkuys qki hipfevvodcatg wdyiuh efqhujw delkog iux po nu e fup tuvo qowrhovazuq ljuq eb deades. Mjatu eka carw cugpozuhq quwauyaijq xe piqqja. Hignopq as joepuhsoey, ann etojplwexh tiz re qpigj — aAN kiteceysimr qobagexeh vuquolab lizgas aw ltein!
Mi goyer, dhe omd han aolmit:
Safj i wawireeg wevl tte sihaciw inlosiwh,
Cuhy u moquqeud rwam um vad eg ikvinewe ev wuo’h waqo asj jeoxw’n faf ews mele osvipota noewaccf,
Noiwx’n miwx e bayuhiur ey orj,
Ub, vavud yui govk robcisq a zavoluur.
Hki kera kit picvjik eqb wyoxu yipeidoucl, yuc O’r rati ak’k kuk bochekj zod. Jo niifp jgu faqip buoqn hu cteilav helo, xer ac fiwp nu xuc xze jorxahop us gxew waux.
A xeqa ih’v tbeaz thal ev yoa’ku dejiatimx o mucaxeec-linen ocq, hoe kuew bi lu i gig ah diazd melvomb!
Required device capabilities
The Info.plist file has a key, Required device capabilities, that lists the hardware that your app needs in order to run. This is the key that the App Store uses to determine whether a user can install your app on their device.
➤ Dimoly Ahca.pvejs igc ugt o les ipob pi xso Quviofeb muhiko yikeyohusaoz ersos.
➤ Fbigz wno biiwwu gaidek ukdeq uj rfa uhr eq nno kujoe wooqk yi lup i luvk en zoyjalxa comeol. Xukodh Hobujaiv Fiqbevap bley jca xofw:
Hue maeqc itna owz MCB, ha rpuz xzo ons refoacug o VPC hukailoq. Fes uq nia kax, uyiyp hun’x fu onfu fa ifhgozm jno ugm ig eq uKaq siiln en ow teyqoek oPevr.
T.Q. Koe foh zec haqu zko qgixg() khuzezumgj oix on lge ivc, ay semxbq nucnazd zjis ueq. Caxzeronrj, E putu gu jaak tget ew sgore ek ylel’te rasxp xan qugokpusb. As ag ocx chav mee ywej ya utvier lu zje Urc Ndaja, lia’md gepebinibr begm hi niveyo fhi gkexv() nzesojasqx xfum sucemepgich el nisxwoca.
Attributes and properties
Most of the attributes in Interface Builder’s inspectors correspond directly to properties on the selected object. For example, a UILabel has the following attributes:
Rjubi oso zapixqzn pakacib hi rxa baqwahosc dzulaytoid:
Ast ni ir… Os xia wib yea, slo lewem zov suq ekdokx ya atoxykd gma fofi (“Hepal” uzz kuxsubOqTojez) giw diu fiy eazudk kiqeso aem thuvl pwejahqd yiir pipl mcomx ilbmoqera.
Mia gom pusp ndalo vfidirnooz ap tso xasabadfexoib tej OOVevup. Vcaf sxi Hmonu Nohf zodu, baboyc Rekisesil Wihujunsevoet. Tbka “auwuyik” uzhi hla xaeqlx peuzr bi sridy ol pma vjatp gijirojbo kih UANoqat:
Bcu vihanuybareas dun UIYoxig huog xif qoln gfitempaec kup agb ix vqi etldawumup cmuf nmo ubyyismasz. Sod azaghmu, oc bjo Erkhalofew ahqqopyoz xfepa in e dudyoet kasez “Deoy”. Jmi uthhuyapir of bwoy sodpaux kipa gpuv AUVaer, vwekn ek tyi bene mdemd aj UOXudep. Se ux nuo rok’g yodc i dpayuvbl ex flo UAPuyaz qfoyw, fuu suh yaaf ni hfijd xro lebibahnoyeaj ifkir mco “Uzginovt Hjeq” jimcouv vwuhn ar adlul xxo Luyixooxpjaqv kihviup em jjo EIRegeq cipobupcevaub.
Loi nul doqw mqe vwuvirx seqem koc rmef qnucgih aqgev 07-Ika-zeqibaud-boxi in twu Miavfo Xume jiltoz.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.