iOS quickstart
Sign in an already activated test consumer and read their wallet in an iOS app. This first read checks your configuration, sign-in and developer proof.
Choose your path
Both paths need the approved inputs below. Sign in and read the wallet before adding other features. Use installation for SDK access and the current release/build status.
The repository starter download contains the new minimal apps from 2dc4eca. They show a wallet ID and do not include activation or payment UI. The original complete starters, including balance display, remain available below at their original 8cf5088 baseline.
Before you start
| Input | Get it from |
|---|---|
| SDK repository access | Wollette; minimal starter 2dc4eca, original complete starter 8cf5088 |
| Matching test API and hosted-login origins | Your Wollette onboarding contact |
| Registered DeveloperId and public material | Your Wollette developer enrolment |
| An already activated test consumer | Wollette's test-account provisioning |
| iOS target | iOS 15.1+; the example uses the WolletteApp product |
The supported production version and enrolment route still need Wollette confirmation. See installation and developer key setup.
Firebase/device association is not required for this first wallet read. It is a separate prerequisite for features that need device association. A wallet read alone does not prove activation is complete.
The minimal starter imports approved development key files through the system picker. Existing-app components read an installed key. The original complete starter uses bundled development credential files. Follow the credential path for the example you chose; production provisioning still needs Wollette approval.
Run the repository starter
Use an authorised SDK checkout at b68c5259a3953e90afe000f4ea0a699b0f4fd9fc. Open examples/ios-starters/ConsumerStarter/ConsumerStarter.xcodeproj, select its shared ConsumerStarter scheme and an iOS 15.1+ simulator. For a physical device, configure your own signing team and permitted bundle identifier. The source-only download also requires the SDK checkout; follow its README.
From the SDK repository root, compile without signing:
xcodebuild -project examples/ios-starters/ConsumerStarter/ConsumerStarter.xcodeproj -scheme ConsumerStarter -destination 'generic/platform=iOS Simulator' CODE_SIGNING_ALLOWED=NO build- Have Wollette register
wollette-consumer-demo://login. Its scheme inInfo.plist, the configured URI and server registration must agree. - Enter the approved API/login origins, DeveloperId and Keychain key tag on screen. The demo tag is
com.wollette.starter.developer-signing. - If the key is not provisioned in this app's Keychain, choose Import provisioned PKCS#1 private-key DER. This is not Android's PKCS#8 file. A duplicate tag is reported rather than overwritten. Confirm Wollette enrolled the matching public material.
- Choose Sign in and read wallet. Expected:
Wallet: <id>. - Use Refresh wallet for the stored hosted session or Log out to clear consumer state while retaining the developer key.
The screen is examples/ios-starters/ConsumerStarter/StarterApp.swift. Configuration fields are not persisted. After restart, enter the same configuration and use Refresh wallet with the same installed key tag. Use approved development signing material only.
The iOS job, including this simulator host build, passed in the 6 November main-branch CI run. This does not verify signed-device provisioning, live enrolment or a wallet read. The app has no activation UI. Continue below only if you chose the original complete starter, whose callback, bundled resources and balance controls differ.
Original complete starter
The following numbered steps apply only to the original complete starter download, built on 2 November against 8cf5088. They do not configure the minimal repository app above.
1. Open and configure the starter
- Connect the authorised SDK checkout with
prepare-sdk.py, following the download's README. - Open
ConsumerStarter.xcodeprojand select theConsumerStarterscheme. - Copy
Resources/Config.template.plisttoResources/Config.plistand set the approved API/login origins. - Supply these files in
Resources/from controlled build storage:
| Resource | Format |
|---|---|
developer-id | DeveloperId on one line |
developer-private-key.pkcs1.der | RSA PKCS#1 DER private key |
developer-public-key.pkcs1.der | Matching PKCS#1 DER public key |
The project copies the Resources folder into its bundle. Its credential helper reads from that subdirectory; no helper file needs to be assembled from another article.
Checkpoint: The app builds and import WolletteApp resolves. A simulator build checks code and packaging; it does not verify Keychain access on a signed physical installation or the test credentials.
2. Register the callback and initialise
Have Wollette register wollette-docs-consumer://callback. The starter's Info.plist registers its scheme and its SDK configuration uses the same callback. Change the scheme, URI and hosted-login registration together for your app.
MainViewController retains one SDK/provider pair. It imports the private key before the first signed request; the provider signs the UTF-8 bytes of a fresh UUID with RSA PKCS#1 v1.5 / SHA-512. The shipped private-key copy remains extractable from the app package; see key handling.
3. Sign in and read the wallet
Run the app and choose Sign in and read balance. The controller calls hosted login on the main actor, then reads the wallet. In its initialised SDK/provider context:
try await sdk.login()
let wallet = try await sdk.wollette.retrieve(provider: provider)The full MainViewController.swift includes UI, setup, task and error handling. See login and Wallet.retrieve for exact contracts.
Check the result
| Checkpoint | Expected result |
|---|---|
| Hosted login completes | Authentication session returns to the app |
| Wallet read succeeds | Wallet read succeeded, followed by the returned currency and amount |
| Balance is omitted | Wallet read succeeded; balance unavailable |
| Stored session remains valid | Read with saved session fetches without opening login |
| Sign-out succeeds | SDK cleanup completes; the developer signing key is retained |
The app does not fabricate a balance or substitute zero. Format currency for your production UI.
Troubleshooting
| Symptom | Check | Next action |
|---|---|---|
| Package/product will not resolve | Authorised checkout, .sdk link and WolletteApp product | Reconnect the pinned checkout and rebuild |
| Config/resources are missing | Config.plist and credential filenames inside Resources/ | Supply the listed resources |
| Keychain import/signing fails | PKCS#1 DER and signed device provisioning | Correct the format/provisioning; handle the reported error |
| Login callback fails | Bundle URL scheme, SDK URI and hosted-login registration agree | Correct the matching values |
.unauthorized | Stored session or environment | Sign in again or renew the host-owned session |
.walletNotReady | Consumer has no BaaS wallet | Use an activated test consumer or follow activation |
CancellationError / .cancelled | Task was cancelled / user closed login | Return to the screen and allow an explicit new action |
Integrate into your existing app
Use the copyable integration components after installing the SDK and provisioning the signing key. ConsumerWalletFeature creates and retains the SDK instance. Use that feature as your app's SDK owner; replace any separate direct SDK service for the same consumer state.
| Component | Place it in | Your app supplies |
|---|---|---|
ConsumerWalletFeature | Your app's long-lived service container | SDK configuration and signer; the screen owns its task |
Platform ApiContextProvider helper | Same service layer | Enrolled DeveloperId and installed key alias/tag |
DeveloperKeyImport | Approved provisioning code | Correct private-key bytes; Android also needs the matching local certificate |
| Existing screen | Your UI/navigation layer | One active load action, visible result, cancellation and error handling |
Keep the feature for the application's lifetime. A screen owns its coroutine/Task and ignores stale results on exit. Navigation away from the screen is different from signing out. The signer imports in the component examples use com.wollette.examples on Android; those helpers are example source, not SDK types.
Connect the iOS screen
Copy the Swift files from examples/swift/Sources/ConsumerWalletExample/ in the component download into your app target. After key provisioning, retain one service on the main actor:
import WolletteApp
let provider = try KeychainApiContextProvider(
developerId: developerId, keyTag: keyTag
)
let feature = try ConsumerWalletFeature(config: config, provider: provider)developerId, keyTag and config are approved app inputs. The complete starter's importer uses com.example.wollette.developer-key-v1; a separately provisioned app uses its agreed tag. Keep the callback scheme and approved full URI from step 2.
The screen starts one retained Task on the main actor and calls feature.signInAndRead() or, after hosted login, feature.refresh(). Display the returned wallet in UIKit or SwiftUI state. Handle WolletteError, signing-helper errors and native CancellationError; cancel the task when discarding the screen and ignore stale results. Keep the key and service across ordinary navigation.
For host-managed authentication call feature.read(accessToken:authorizationId:expirySeconds:) with the current consumer session. Restore/renew it through your authentication service after restart. For a stored hosted session, refresh and handle sign-in-required errors. On logout cancel screen work and call feature.logout(). If you later add a separately retained Bluetooth client, stop that client before logout or changing consumers.
Next steps
For a new consumer, register, sign in, then activate the wallet.
- Activate a new wallet and resume an interrupted activation.
- Add push/device association before features that require it.
- Use Consumer contactless payments for the iOS Bluetooth client. The legacy
payments.paymethod does not implement consumer NFC/HCE on iOS;payments.stop()does not stop the Bluetooth client. - Follow sign-out and consumer switching when adding other features.
The download records its actual build checks. Signed-device login, Keychain relaunch behaviour and real bank/payment flows still need acceptance testing.
The public-key file in the original complete starter above preserves its supplied resource layout. Native iOS signing uses the private key only; new hosts and the minimal repository starter do not need a bundled public key. See provisioned keys.