Search code examples
iosin-app-purchasewatchkitapple-watchapple-watch-complication

Using in-app purchases for glances and complications in WatchKit


I am making a native Apple Watch app, and wondering if I can have glances and complications only available for users who have paid for an in-app purchase.

Also, if they have not upgraded to the in-app purchase, then when they go to the glance, or click on the (disabled) complication, a view will show saying: "Please Upgrade to Pro for Complications and Glances". And there will be a button saying "Go to App", which will open the app on their phone, where the in-app purchase button will be.

Is this currently possible?


Solution

  • From the developer's perspective:

    Is it possible as a developer? Yes. In regard to the complication controller, you could only return timeline entries based on the existence of a valid receipt.

    Since StoreKit obviously isn't available on the watch, the phone would have had to validate receipts, then provide those details to the watch.

    You would need to handle any edge cases, such as when the in-app purchase state was initially indeterminate for the complication controller (since it launches in the background before the watch app has been launched for the first time).

    Complication controllers really aren't designed to asynchronously fetch anything (from the phone or network). It's expected that their data is on hand, and they immediately return results for data source requests.

    It's not practical to have the complication controller try to fetch (receipt validation) data. At best, all you generally can do is request data for one update, then manually update the complication a second time after the watch extension knows to offer Pro data in the future.

    A more modular approach which Apple recommends is to separate the functionality into a session manager which provides data to a data manager, and a complication controller which retrieves data from that data manager.

    But you really should get the following question answered by Apple, before you spend time designing a watch app with those conditional features.

    Will Apple approve it?

    What you're proposing would only show placeholder information on a glance or complication.

    While there are apps on the store which provide in-app purchases for additional complications, those apps support at least one complication to start.

    Would your app make it through the review process, since it effectively provides no complication (data) to start.

    That's an off-topic question which no one here would be able to help you with.

    A simple answer for your "Also" feature:

    There's no way to open an iOS app (in the foreground) from the watch app. Your user would have to open the phone app on their own, then navigate to controller which offers the in-app purchase.