Implementing licensing mechanism for Applications Distributed in App store

Solution 1:

Licensing Schemes

No, applications can not use their own key based licensing system with purchases being handled by Apple's App Store.

See Apple's Validate app and in-app purchase receipts with the App Store documentation about how to handle App Store purchases and the Receipt Validation Programming Guide.

See WWDC 2018 > Engineering Subscriptions for more information on implementing receipt validation for apps that contain auto-renewable subscription products.

Apple does not provide licensing sample code. Apple fear that if everyone uses the same implementation, it becomes trivial to bypass. If you need code level help, contact Apple and use a Technical Support Incident.

Trials

Apple does not accept free trials in the App Store. Applications must have value that does not expire. In-app purchases can be used to unlock additional features. See App Store Review Guidelines.