swift


SwiftyStoreKit syntax changed?


I am following a tutorial for implementing in-App purchases, https://www.youtube.com/watch?v=dwPFtwDJ7tc&t=1170s and one line of code is different to the tutorial when I try to write it.
The video says to write the line of code as:
SwiftyStoreKit.verifyReceipt(password: sharedSecret, completion: {(more code added here)})
However when I write it out the only options that come up involve another part, this being 'using:'
SwiftyStoreKit.verifyReceipt(using: 'ReceiptValidator', password: 'String?', completion: '(VerifyReceiptResult) -> Void')
If I just delete the 'using:' section an error occurs. I'm a fairly new developer so it would be great if someone could explain what this means, and how to fill this section out.
First of all you need to create AppleReceiptValidator object and pass this objet to first paramete like shown below.
let validator = AppleReceiptValidator(service: .production)
SwiftyStoreKit.verifyReceipt(using: validator, password: "Your_shared_secret") { (result) in
switch result {
case .success(receipt: let receiptInfo): self.reactOn(info: receiptInfo)
case .error(error: let receiptError): self.reactOn(error: receiptError)
}
completion()
}
I want to notice that in the Apple documentation is written that you should not send receipt to the Apple backend from your app. It should be done in this way:
Your app sends receipt to your backend.
Your backend sends receipt to Apple backend for validation.
Your backend gets response from the apple.
Your backend sends result back to your app is receipt valid or invalid.
In the Apple Documentation is written about password: "Only used for receipts that contain auto-renewable subscriptions. Your app’s shared secret (a hexadecimal string)."
More about it here.

Related Links

Popup window in OS X App
“Fade in and out” animation does not work
Swift 3 : How to create instance of underlying type from Any
Enumerate class members in Swift
Swift: flatMap to Dictionary
Move PHAsset from one Album to Another (Swift)
Non-self delegate is not called
Firebase and reading nested data using Swift
Wrong drag and drop location NSTableView
Swift two delegate function for textfield
Swift linker error in release build fixable by adding code
UITableView row won't removed after being deleted
Simulate Single/Double Tap Swift
How to have a sprite follow another “within bounds”
Azure notifications hub can't register template with content-available
CollectionView Error [swift]

Categories

HOME
crystal-reports
google-cloud-bigtable
wsdl
boost-thread
phonegap-cli
branch.io
defragmentation
histogrammar
nodemailer
vsftpd
actionscript-2
facebook-javascript-sdk
google-classroom
wicket
outlook-web-addins
uiview
mod-pagespeed
sendkeys
grub2
jpeg2000
internet-explorer-8
propel2
mousewheel
ng2-dragula
uiautomator
esql
thingsboard
onsen-ui
tcpclient
yosys
onesignal
branch
data-conversion
google-api-dotnet-client
pep8-assembly
hibernate-cache
shapes
honeysql
windows-10-iot-core
rider
.net-assembly
socketpair
elfinder
meta-raspberrypi
onbackpressed
web-development-server
sendgrid-templates
tripwire
powermta
resuming-training
rich-text-editor
tiddlywiki
info
alter
push-diffusion
windows-azure-pack
icefaces
shipitjs
achievements
gradle-release-plugin
dac
aerogear
anythingslider
direct3d12
built-in
webhdfs
urn
achartengine
rx-groovy
graphical-logo
viper-architecture
git-checkout
vcl
em
iostream
humanizer
httpcontext
voldemort
indexing-service
dvcs
magicalrecord-2.2
bignum
driver-signing
qss
objcmongodb
snapjs
sametime
icsharpcode
returnurl
gdt
ou
galaxy-tab
printing-web-page
qtembedded
gtk2hs
authenticode
port-scanning
ruby-debug
symbol-server
carbide
hardware-acceleration
revision
system-codedom-compiler

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App