# Demo app

> A sample iOS app that runs the SDK against your own dashboard app and checks each call.

URL: https://docs.xulo.io/ios/demo-app
iOS SDK version: 0.1.4

The demo is a public sample app, `xulo-ios-demo`. It uses the closed package, so the SDK source is not in it. It runs against an app in your own dashboard.

## Requirements

- Xcode 16 or later
- iOS 15 or later
- An app and its App ID from the dashboard
- A physical iPhone for a real push. The simulator can run the API checks. It does not receive remote notifications.

## Open the project

```bash
git clone https://github.com/XuloAI/xulo-ios-demo.git
cd xulo-ios-demo
open XuloDemo.xcodeproj
```

The project already depends on `https://github.com/XuloAI/xulo-ios-sdk`, version 0.1.4 or later up to the next major version. Two products are attached:

| Product | Target |
| --- | --- |
| `Xulo` | XuloDemo |
| `XuloExtension` | NotificationService and NotificationContent |

## Signing

Select your team on XuloDemo, NotificationService and NotificationContent. The bundle ids are:

- `app.xulo.demo`
- `app.xulo.demo.NotificationService`
- `app.xulo.demo.NotificationContent`

All three targets share the App Group `group.app.xulo.demo`, which is also the `XuloAppGroup` value in each Info.plist. The content extension category is `xulo`.

In the dashboard, create an app with the bundle id `app.xulo.demo`. Add the Apple key when you want the dashboard to deliver a push.

## Run

1. Build and run on a phone.
2. On the first screen, paste the App ID and tap **Start**.
3. Tap **Allow push** and accept the system prompt. The subscription id on that screen is the device in the dashboard.

## Checks

Tap **Run all checks**. The app calls the API and marks each row Pass or Fail:

- Register, a numeric external id, and a blank external id that does not log the device out
- Log in, tags, and open
- A session posted twice, counted once
- An event, a purchase whose second post replaces the amount, and a refund
- An in-app card request
- A failure report, and a crash report that is refused when it contains an identity
- A local push open
- Log out, which keeps the subscription id

Two rows stay marked Look. The push token needs the permission prompt on a phone. An image push is sent from the dashboard to that subscription id.

## Send a push

In the dashboard, send a message to this device. An image push is downloaded by the notification service extension. If the download fails, or time runs out, the text is still delivered. Long-press the notification to see the content extension's view.

The demo's entitlements use the development push environment, so a run from Xcode registers as a sandbox install and Xulo sends to it through Apple's sandbox gate. See [Sandbox and production](https://docs.xulo.io/ios/apns-setup#sandbox-and-production) and [Troubleshooting](https://docs.xulo.io/ios/troubleshooting#nothing-arrives-on-a-build-from-xcode).
