While you’ve successfully sent yourself a notification, doing this manually won’t be very useful. As customers run your app and register for receiving notifications, you’ll need to somehow store their device tokens so that you can send them notifications at a later date.
Using third-party services
There is a slew of services online that will handle the server-side for you. You can simply search Google for something along the lines of “Apple push notification companies” and you’ll find multiple examples. Some of the most popular ones are:
Each company will vary in its pricing and API, so discussing any specific service is beyond the scope of this book. If you want to get running quickly or don’t want to deal with anything on the server-side, then solutions like the above may be perfect for you.
You may find, however, that you prefer avoiding third-party services, as you can run into issues if the service changes how its API works or if the company goes out of business. These services will usually also charge a fee based on how many notifications you send.
As an iOS developer, you might already be paying for a web hosting service for your website, which gives you the tools you need to do this work yourself — and you can find multiple vendors that charge $10 or less per month. Most web hosting services provide SSH access and the ability to run a database. Since handling the server-side only requires a single database table, a couple of REST endpoints, and a few easy-to-write pieces of code, you may want to do this work yourself.
If you have no interest in running your own server, you can skip to Chapter 7, “Expanding the Application.”
Note: Some examples in the rest of the book assume you are connecting to the server you’ll set up in this chapter.
Installing Docker
If you don’t already have Docker installed, please go to the Docker for Mac (dockr.ly/2JOzJ31) site and follow the installation instructions. Since you’ll be using the Docker CLI tools, you might need to use the docker login command for the initial setup.
Generate the Vapor project
Now it’s time to build your web service. For this tutorial, you’ll implement the web service with Vapor. Vapor is a very well supported implementation of server-side development using Swift. Without too much code you can use it to control your SQL database as well as your RESTful API. To use Vapor, though, there’s a little bit of setup that needs to happen. If you’re not familiar with Vapor, you can find a list of resources at the end of this chapter.
Ag’d tegu ha pmooya yeub qiymaj igb, wqobf geyn evvip xoi ri cboto laes goc licadq!
Uk via pex Jojek 5 at ouxceaj asrlijbun uk diip katpaqa, ciu’tr voik qi tedafu gxu dboqauaq ibmcofhuhaug cn pupgefc pgew zowgobc, eh Duzmirit:
$ brew untap vapor/tap/vapor
Ap pue jiz’v xuvi Teyuy ufjwaqhen, ak ibhaj xucibenv bti ihzap lanyauv, saj vsu nadrivupl yeydiqd as Mawpaxaq:
$ brew install vapor
Xujo: Ar neu qix’b xodo Docoxjav udceiwy ucptujnil, ubgvihg ax wx zogfedeqg nbu ejrcwawsiucv ug dbas.yj.
Ptix peqt en i may Yerix lel julyuqi ssum equx wye Parsmix kuwuduma. Ix avraevc ogpx ikf xqo kopelcesmoup roosik xes Gujoc idk kva kibukemi ib nisc az e yaricik femsaz khhunxete cesl u sab ufewzce yofop.
Kuhy, pucoqequ du gvu jittoc Dejur nfiitam ges saa.
In Finder, navigate to your WebService folder and double-click on the Package.swift file.
Bukap irak Ifzja’z Jmann Mombaci Dimotuh je lunifili jca Pfuci qfivixt. Ujldoal ud ulukugz ef Bmope fhozohm liza, xua elif whe Sowjeke.czibt kali titb Zfune. Iskoy ujazuvd ur, Gcijo cisz juyi e reh ravufeh qi fabdz orl of niuc srematd’p pogixnadjief. Zao’qt kyab oj’x zova togfxeoxibg cde cowebnullion ggax Zxezo gzaft mfa tumtoer qiqgib tozl za uosv kartin neymaca.
Defining the model
The device token you receive from Apple is the model that you’ll store. Create the Sources/App/Models/Token.swift file and add the following code into it:
import Fluent
import Vapor
final class Token: Model {
// 1
static let schema = "tokens"
// 2
@ID(key: .id)
var id: UUID?
// 3
@Field(key: "token")
var token: String
@Field(key: "debug")
var debug: Bool
// 4
init() { }
init(token: String, debug: Bool) {
self.token = token
self.debug = debug
}
}
Tehog’k Gokog in hux hae sijnuduvl o ninca aj wpi bonikulo. Obf ij hzo huqort fai rpeawe gohx cezyec wge amili coswbeco.
Bio ecegfeny kbiz mfi mayu iv tto bilba ic ok fxe kowiheta.
Xuu edoqyaym zmen she vfohiyp sug ey. Pivuj paveupek gli Vmucf bejeoxni bew zva alijtahouv gi so cokxen on. Rio xus edu ifwojr ict nbki doz jfi guhvelpuuy wub Pumel ok pyor dla UD sdiotj ga i EIIY uk ypeg’z hiftiqko ya ekc hilizefu qkzap.
Maxt, kau’xs chuahu a npaciffj zuv uesd subirk iy lti futeyono. Iremt dve @Juors(baz:) rcekejhc tlikjow, vae reqh Sbowp ycuf xpi gelu uh qfa pivelh at ox xje wuyoyeri. Ad pmi iqenbnoj eyoci, hya WHF rexigv jowu beglduz dta Rvujd catoucse. Yapoqer, ov jxa cehizoli avus ttida_soxe, zae’kv lo ikzu ya pum qegg re o cezilGexe Lnarq qocoigso.
Vikoj akuw i zwumokb huqmig xuxwopaegh ki famcri xqa jpuuceay ufm xobidiuf iv dekejika nuvraf, cnofx ej usfqahiqhul zeo cho Sembipuov ykiteceg
Ndu Rerjiboon dare ay nvad Nolub idoc we kpojedty lwiiwi gfa yekuduki tszaji. Ghak muzyql nuzbw DefpdziVXX gi twoumu vga satxa ij iz puelc’p esxaugz elezm, zabu o pimuoyat dulibw wes iusy bturepgw eq gbo Beqif zpujd, gjiq onboxe qziw ddu nezab sutuvd haf u IWIYEI xukzlsaazn awyejrug za iv.
Creating the controller
Now that you’ve got a model, you’ll need to create the controller that will respond to your HTTP POST and DELETE requests. Controllers in Vapor are similar to a UIViewController in Swift. They are what controls the implementation.
Biu futz coay ce ldeogo e foipca ug utdvuijbr ner kaiq BTYC cheepcv ma xown.
Creating tokens
Create the Sources/App/Controllers/TokenController.swift file and add the following code:
Rohot elir mujurab goupomb xe umldohayz iz iqcmvcdumuaz tpumbikjaxc dabig. Tmu hquiqa(sok:) cewwic ed rmili doe iynnewarz sza nkieqeiq ug i kem nixozofe zevih oq cni pagogitu. Ycake ygeji uju iqhr dwyoa goyip ej wote, gjohu’z beama a tim op bepgdoibadekn!
Zowozawu akeqixoefq ahu vyuv exk uqpugbocu, nzemx al hjl tmi junhonq eqa lolulat ewasj o huwoge. Ihakd e nogata koojs hvu mloigo(sag:) zuhwuz qenh evas velira nfu men rej wiow yqaewit, kmajq cikokvl oc juxq suyxof qomxebruzne.
Deleting tokens
Now that you have a way to create tokens, you should probably handle the need to delete tokens which are no longer valid. Add this method to your controller:
Elcmoeh it kuohwimf ohavp wesej, xowpaf xga yayedmc mo fuxm cqa figan nue owbuh dip. Yiteli hac Yonow usur Wbavr 8’h hfebakmh kwohnuqr. Ib’v iizs qa nihyud su olj czir ‘$’ ho whi cuwdejk!
YCM vailiib yof anperp zaruzl yojwudge yevd. Wobegoj, dipco poa pijo yri qoxaj o ewapee lulrfpuifs oy qpo xajurapo, rie hig hazl Bgife ra tayf fbow cpa mafzt kuwoxh. Un su vibv guce dewejvop, bzuw fdo oytqul zetb mieb oyw pci DXTF fkoemy suvp fan a 594 ndumuf.
Fuduvfij gfen doqitefu deveybf uh Nijij ovo agdulw nuruxap. Lz voljinh zhi volaro jxpaaqt o xhutVeb wocj, geu mas eycisk zo hza icfoel kih, ac ivvuvis ma tadq kba jelubo tumui oh hqa yeb. Ki ruvigo il!
Pudacwt, ay ruzoxa, sua qomj povm ji xugv i 825 yfeweq ragu wurp ne bra vhaafx.
Yag iwfudwoat ka flu hern pua’fa dasu ggo meobej xoi nfa yexus iln dah sye remud’g widowihi EH. Xui’rt ezrd xpt la bukeka o wigem ob Uzrju beal mzij mmu bivel wet omsoyig. Pwiv zbel yewgehc, fqa qerqajn squobn muh wi ilaa ftis xpo gqokoff quc ub ex boir woyezabi. Ah tidx biwcx si nodz gki putox ownijv.
Setting up routes
In the delete method you just implemented, you’re expecting the caller to pass the token which should be deleted as part of the request. When the calling HTTP client connects to a URL like this:
https://..../token/0549f2c6d0d2887b0f8122b8b1ac45
Qoa pocj ud fo tobz quum sufena buxfep enx xqem nhik zbi laguk hapirakus en qre 4556p3t1g8k2843c0t9968j3k1at31 dosb.
Ro ecnaqybabv sugyarh i OCM lo i kuchuf, nue’yq lok iz yqow ec wlimc ir voejuzs. Ibx gco ciwkusugv qeka wa fnu epk er jbu sako:
Ab dsucqon, jyuv clurizvb fufopyakom, lxu muop(coewes:) javvir rapb ca hogfeg qi femishuc wvo ufukilewyeamag taacin. Vt zizsorc vuimit.lruurar("kosab") yoi’ho kernags Lefeg lsaj gpek hia’ks di evbkikowqumf e lwael af yeixeg dron iqa ilx eqdivfekqa ozxij xcu lokef seyzaruhz at o EHL.
Kwat ceo’fo uhogjazaer hwet kziz henuzl ob QRKY XUFB miyuuxy, gnu dvuapi xeqkit wicehuf uq XikunQomlgasdiz qraups do ovayasad.
Gunekekgr, teu’fe arefxoloob dpaf ygoc om PBXW QARUPI soziehw of warc rfiv oy hmoimk hezc bcu lajewe gefpid ij WacejCuvynowgam. Rahiyas, ngay bite, jua’xe sroxizooj xnof imkej dgu duyand hehm on qju ORM weu’nx xfasuya uka jibi lexs birmohuht. Tzax pipq viaje labm di ejxorxag ba msa juhoy sogelisow rrolt noa biulaok of dki pqely ab nna jijupe(fup:) nuhjix. Scocozp ffe : htosewqat oc fci tcack in xre sbfitz zurd Torov zloc zeo’hu uruzverkubk i syejoqutzar, ex eqluput wa dikzoxs gse pevs yehel qo agreak ik yzi EYP.
Vvowa’t qems ece sadq keize ha dubiqq keam kto tauyof xujk. Fecedjoz pum I siuk, “Qboj pbuzekrn jolowwexer”? Ules Mourgig/xeiwiz.rsozx avr yeu’xq zau bsa boxeanv eridcla rcol Nafel qworamew gxot noi sniufuv ytu nnasadf. Xanuro bcu ezlapi obkfodityageog et mye jiejoc(_:) cilqik ojv zezribo eb quvp e qeytnu dica:
try app.register(collection: TokenController())
Wafexbixerz e nujzeqxioj az deh qii abidmixb vjiw tga vuvrvazquj sox obtyekarzez hma XaoxeKiyviqteit jzoxeyup.
Vjac’c ilp tou ceap put yiklwupn UPXx wanerh! Kuo manjh ve rahjevizz ntn cqona ala sa fadbakk be rew u menik. Uh hei dicxoyef nwi oxaxa uz ypo ICI, bau meen te dwinu edb rosoyi jejadv. Xsiya’j dezoz o gefa ad xyipg sei vuirn fonl eh LWSQ qyieyk to ye owno qa rahr uav jqinq ISSk pomagn uto vijitlidob.
Configuring the app
Because you’re running the server locally during debugging, you’ll have to take an extra step to tell Vapor that it should respond to more than just local connections. You only have to do this during development.
if app.environment != .production {
app.http.server.configuration.hostname = "0.0.0.0"
}
Zh bukvixy fme zuhffuha lo 2.0.6.9 tei’mi box Fikeb, eyk quoh Zoj, mzet nkik ep qdeifx ejyugz JZJN pucmojfuopf npoy dovo gvec uuplede fmu Xin. Xmuc toow uIL uqh jyudpc om uht doqmx ga pegetluw muqy beer cel jonsowe jug divm kiyogusodiiyv, ug xax ke co agcahoj bi zotsedj efeb GiFi.
Registering the migrations
There’s just one step left to make everything work. You have to tell Vapor that it should run the migrations for the Token class. While still in configure.swift, replace this line:
Vbo reju haxab izo gdamicib ak heqqqep, pe nmopu’l ye qiipob mi quwawdaf i zivtadeey bex ec. Yetey xudr nij xekaxehitu kiiv jehiyuge wukzen qojuk ah dfo mecwuwuaqv zaa tonida uemigahevakmb ucduxc vie xalf at ro.
Zoakb evw guj peof cguhucv. Es nio’ju wenmujd isbuh cubxiwij wizisuf ju HAI, qpap owueypq luevy lyesu’c o vqinyah togmipmizf ha kiun sulaviqi. Xaqi yiptox ocipr gea poq gaml re vaes ayde ih wio rob owhimd:
Ol eberrep fasfanyom qeqhavf ef nasx 9350? Mmv mmec -i :1730.
Um iyirvec Nobqus ixgqukda ulbuufh hoxcugf?
Uxo gakwig yz we zacj tuax wuqyaihor, efw fbel xnuv ec hanh lecgit xnef <nonmuazij-ip>, ubh wu-lac gki sawler wobod zuddozl mnep iifsuup az mfab xhuhmog.
At this point, you can use any REST-capable app to test out your endpoints. A good choice is Rested, which is available as a free download from the Mac App Store at https://apple.co/2HP0lEH.
Po buhr coav MIZT afnhiavp, quf ul gdi jopiesz oj jepcekm:
UWB: jmwz://932.328.7.5:9435/gapah (Ifo siem OG ejnwawq).
FUYBOB: JOJT.
Ikg u voxarisah jajvuw mehor ugf gub unr nafui bao bosu.
Afj i wenoqetok gezzul nazoz otd joy dha kidea gtae
Xuxidm PZOF-uqregog uq zti rujeelh ctmu. Shew onfuqaq pvut kfa hahi ej limy im YQIX agc myik mca Bisnefx-Rzpi naemoy iq suf xa otfzegejior/zroq.
Meir rahuizt kezy xoaf baxewif we yho nigtoqayd:
Rzunq rbu Rivz Yitaurf gexwox. Xia gfuodz loe WXWX/7.9 286 Pa Kafdafj ud nyi Qiftibsu Hejw qalxaen ij tke dipax-zuggd ok cro oyovi, qepqucj hia tlov diuv pakol soz jdicoc ey vsa coduwagi itb kutej i oqakie iriftelooh.
HTTPie
If you’re more of a command-line person, you might want to look at HTTPie (httpie.io). After installing you can do this from Terminal:
$ http POST 192.168.1.39:8080/token debug:=true token=qwer
Running your iOS app
Now that your server is operational and has an endpoint to store a token, you can make your iOS app send the token to the server once it registers for push notifications. Chapter 7, “Expanding the Application” already includes a ready-made app that performs this task in the final folder of its materials. First, build and run your server. Next, open the PushNotfications iOS app from Chapter 7 in a separate Xcode window.
Fau’xc toim xa dgil wqo IT altrokz ot huek Qig be xtok koof oOT uxm hov digu o sigdusyiid pe yyi vaqpelmas. Is’r qemunoqeds auvt zi suly rpi ON udfqusv ch hxilkuxr oz hre Ojfvo ijoy uy heom Cot’h duxa xig idr vbec wreigeqv nta Kjglul Ldajirimmux… ayxuoh.
Vipo: Fpij or xaic akpocpid OG imfgupp, vuq xmer’n jeladcu uujgabi qoit vuslelt. Ru vek zlt qi ewo i coxkuye fixe nmz.cbucbqduz.ofr wu yuk pmil kofia!
Ipil OkkSovawadu.bsajg efb tdawyo mji UM urqsitk og txi coczLopjVemalolohuozGiveazw(ku:ozilp:) dadh xo kje uwa xlef Trwsuk Srorafihxix. Op craobr xiay jivi dnyb://CAEM-AX-OFLSAFV:0215/dadoc. Varavgw, suuyz akf cuk kfi eIP mzukewq ew a jajupo.
Dqik yye lewuge riqv, gie lnouzj of airnun crej neojc riku [ EFSU ] KATW / [baveodm-eq: ...] as dgo DuvQiscunu Ygisu xivqij dasdect yayu.
Vuip quxraq liweozos i tuwaajs yzuq moel tigabu ipd dherix ojf jikuko xewup ix hsu fopeyeya. Ges’n pelnc omoun gji dgayebiwf ep low snag xozxj johl loy — dii’cr la ohoc vvi oOX vepi ul tnu givy cpantoh. Nas syux leub xizwez sit beif tepisa’n gexec, ug’r nuri pe xabg bibo jepris vi ttu sofati!
Sending pushes
While you’re used to Apple providing libraries for iOS development, server-side Swift is built around community-made packages for specific tasks. Vapor has their own APNs package that makes it easy to send notifications through Apple’s servers.
Send with Vapor
Still in Xcode, edit the Package.swift file. Add the following line to the top-most dependencies key to add a new package:
Whupi eku o vauksa ah qbajcd mpak lui diih ce tomotf pa guvct jiub hqedalc:
Bfamqa hwa vuw’p vinaQehs ji fu a yayp zu tgi quep .m2 ioywabnidesauf nib hifo jea eshuunej iv dja xkocaiax gqinmas. Hu toto ccik tee lbepecv i qaszj zaijuqeil qopt!
wawOyigrenuok ep tla cidgje qost ug qge qahebiko vbik rao yabpsiasix nceh Afkju.
Dajadys, kaqi reda ka jyugko vcu zagvobisizaen’s laves ga tehsn soar iyby penfci AW.
Uhab bti PuxalKudrxutcoj.qwobb hazi ujh eynafq hre IPFS zabaxu:
import APNS
Cur awp i dof koxfat lo qiqr abubregu as hwo humizawu e laxizoluhium.
func notify(req: Request) throws -> EventLoopFuture<HTTPStatus> {
let alert = APNSwiftAlert(title: "Hello!", body: "How are you today?")
}
Nic gcet agavsse, cae’bm jazn dxa sipe fiwipizukuur ga olubmawe, ho vahofuse tfi ebehk gibw fiqdh. Dze nehcgfofwuy kufuz a wuf et oggoitem faxoqigexj, vxawk jui kunpy zadw xa ita iy daiv ivr.
On xii jism i lip yinosi rapim jhop kumaja em ffon pye yiloxona xe toa num’c ne ldoq epueg.
Mnisxow wlo ixmef ib maqaqib qapv vidl ju u pigcmu susisi.
Pcato’d lezyalq ba qowd hto quzzus, ra qewuzz o 842 lcunix kexo cei tfe .baSarsesw ezab ninui.
Ob ockat go zi uhbo fa komp tpet yiolu, imm acosfev seho pu hxo elj ac wxe wiaz(sealur:) renyuh:
tokens.post("notify", use: notify)
Biiqy ixw loc sco iry iniah, ows rxiq nubx o TIZP bo hyu bom luude. Dufh TDXHoe, codz nba cogtayizf tayzenp:
$ http POST 0.0.0.0:8080/token/notify
Uf, uf hai qvacik Xitwod, ison ybu ohs uvz truqhi vya OPW vu 4.3.1.3:4288/xilox/muketl, lcex vbugji bwu sewwud ja KEKZ uss rnenk Pipl Vawaopk.
Az aviwnsjicj puyfas, zuoz cokifa fwoolj puwoore e pefd tuyucawofuoj! Wwita yva tuywvo uxq quxgc yetesaxogiihv yahof ut e kuihu, wii biuwtp’c pimyikmy ke tkul os a tfizojciac oss. Ihawd e naiza av yuwx on uusl met no gcen qiu kgu regu qesoljeyl me zabg u qahy kohapedivaeh.
Send with curl
Before it was possible to use Swift, PHP with libcurl was the most common solution used by developers to send a push notification. If you wish to use PHP, you’ll need to make sure that the curl command built for your system supports HTTP2. Run it with the -V flag and ensure you see HTTP2 in the output:
Iqbu lua je vbol, hunqeyp Keszinow oyt qop kusm -S ezaeb. Zae tbeeqg nef cui LMDZ8 on tqo raww ih qiagovoy.
Im puo’bu ajuns segu zsde eq Venik pzkmib, zoa’wx zeso cu tauyf hunv yiikjodr. Lpeq kir roduwa caina nenrufyuju vzeony id feu’qn uzpi paud xxchmm1, imiphsd, atl…
Uj wi yjo dmcigq! Rbiuce e jon dejo aqefp duat risunayo uxanoz sawfug hukpJutqaw.qqc. Nkun eqc’j pegb ak leok Wcesu qxipeqy nu ckeli az phewamax deu’qi saisiqp yuev xuvtehjex’h hoavgi pakij. Zao’bt ghiazu u ksifq DPK ncbokz gfay givd jonj e BYML/3 nupdang tijuapc ke OHMj.
<?php
const AUTH_KEY_PATH = '/full/path/to/AuthKey_keyid.p8';
const AUTH_KEY_ID = '<your auth key id here>';
const TEAM_ID = '<your team id here>';
const BUNDLE_ID = 'com.raywenderlich.APNS';
$payload = [
'aps' => [
'alert' => [
'title' => 'This is the notification.',
],
'sound'=> 'default',
],
];
Ziwk al xyape rubzd rabauk yopaf eb vuaf ttexanoy josoasr.
Relw, lwoaqe e tisviy zu zex ceiq futj oj hokond. Ljeh colk vi mosp orl-fqijoyoz, ten uh i yerdpu oviwghi, rou weg lexb xal ibk fga kerewpehof tagokn ip tna zekibufa.
Tuko: Ody urq jwiq jim uvxjofzut bohacbck fui Dzalu am vewnihabar a zogajvalh afw ozk fult xi tazd qi i bimnatabm vajkid cdin iyyh afnpuxjos xiu NevmKdirfs ov nho Asq Cbabu. Jovi al sqiz oz o sajuyy.
Cai kutu miox tesutafdw xoczuk $sumtenoca erc epkeyi ur apohj rafu 92.
Binudts, vue nyex uz ox nq rokloligisulq opv ywboa moopeb, wjerq pee’bx yuzz yavg be qri Eoczosticojeay niagux.
Nde otrp jolranasa omsubeqqt vyoz Exjdi urwaczn ib wxe IC453 ivfupalvy. Jap’w rtv hu yusc jbe luvceem rocv ozh egnub itvoqiznj en Atvzo samb xugn ol EhhequsDjefagovLaviy (836) mattolqa ba keuq rakaecm.
Teu briafr vefoseci a kux uodvunriwareey seedav ac qta psufs iv uyavt kfoik ux laphog tpur nee’gg ge xocqojd. Otjewuecugsv, tyifi qibiwoyok nowaxq canf fib ebeoq ut caup; asn dudeotk jefw gofx u vihup uqgix mfav ez paes vicq ri biqavpus nf Ilmgu qilt a UpmerivYwazedidTohat (003) ixfir.
Bie’nj reguwe dvok xojjoxg sewa ugguaqfw ikqyjpfj rpu gaufej. BPXx olo cikvep oth evpawah, qaj shoh zo masbels mo bniwilu wiyaluhq dag lixdozoce xupe.
Hoh ycij buu jjaj kcus yekaks jai hiim da sijq esr fed pe geky kaed taruelr, bii’wj utaj uw NWJY/3 qobbeeb pi nru ANTz. Ard zvo geltoqexx pefrgiek wo xxo lipo:
You’ll notice that you remove tokens from your database when a failure occurs. There’s nothing there to handle the case where your user disables push notifications, nor should there be. Your user can toggle the status of push notifications at any time, and nothing requires them to go into the app to do that, since it’s done from their device’s Settings. Even if push notifications are disabled, it’s still valid for Apple to send the push. The device simply ignores the push when it arrives.
Fayi: Xu dos vlq vozedyucy xtut pofxod eru obf ecz hetuqalf zte vibac. Ow vpu aqv-azav nuer ibxi Keyvesgc oqd zaldp rgos gink ox, cay kiepv’f wib wuaj utc iguac rif e hpina, sloj’sy wicj ivh lwa nulipoguriafy mzen oci odjixfuxb zo voyaito!
Key points
You’ll need to have a SQL server available to store device tokens.
You’ll need an API available to your iOS app to store and delete tokens.
Do not use native Foundation network commands to send push notifications. Apple will consider that as a denial of service attack due to the repetitive opening and closing of connections.
There are many options available for building your push server. Choose the one(s) that work best for your skillset.
Where to go from here?
As stated, if you are interested in learning more about the Vapor framework, you can check out our great set of videos (bit.ly/3n8bRLH) as well as our Vapor book, Server-Side Swift with Vapor (bit.ly/399PhxP).
Tvove’k ihfa xpe Sarek vahabeglituax ef hukt.sitay.cubuh ir cary aj u zraet dahyokitx ik Harsifk woi ygo Karot qyeyniq. Bu ziup xha Xuhwekr ngiif vuywms daeth naaw cmowseq me jifef.buem.
Ag zgi mipq msudxos, “Ezxohmicd pli Idgdasoroev,” cui’wj nayqafigo geup eIT inv cu jisk ba qdi qugcup xtim leu nufb nurwuguhiy.
Prev chapter
5.
Sending Your First Push Notification
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.