After my first apps are now available on the Mac App Store, I wanted to prepare trials versions of these apps (something I should have done before launch, I know). Especially, I wanted to have some code ready to drop in any app to create a trial version and I surely didn’t want to maintain two separate code versions (or targets) for the Mac App Store version and the trial version. The following is a how-to for myself and might be useful also for you, fellow developers.
Code signing for macOS.; 3 minutes to read; In this article. An app must be signed to pass the macOS Gatekeeper and to submit an app to the App Store. Sign a build by uploading your provisioning profile.provisionprofile and certificate.p12 when configuring the build. Connect your device to your computer. On a Mac with macOS Catalina 10.15, open Finder. On a Mac with macOS Mojave 10.14 or earlier, or on a PC, open iTunes. If a message asks for your device passcode or to Trust This Computer, follow the onscreen steps. If you forgot your passcode, get help. Locate your device on your computer. Code has restricted entitlements, but the validation of its code signature failed. Unsatisfied Entitlements: We are using 10.11.6 and XCODE 7.3.1 but we just dont get it. The App review were able to test the app about 4 days ago and recommend we make some minor UI changes due to Mac App store policies but now its not getting past the startup.
First: Create and Edit Trial Version Build Configurations
Yes, I’m working with Xcode 4 and my existing body of code is the code of the Mac App Store version of my app. To this code I will add the trial version code. To start, create new build configurations. So far, there should be a debug and a release build configuration. Open the project info window by clicking on the blue icon in the navigator area, then on the entry under the heading ‘Project’ and finally on the info tab. In the ‘configurations’ section there is a ‘+’ button to manage the build configurations. Duplicate both of the existing configurations and rename the duplicates as ‘Trial Debug’ and ‘Trial Release’.
These new build configurations will get some tweaks. Click on the build settings tab and change the ‘product name’ in the packaging section to indicate that the trial version build is a trial. In the same section, set the ‘Info.plist Preprocessor Definitions’ for these build configurations to something, let’s say ‘TRIAL’. This allows Xcode to know when you’re building the Mac App Store version and when you’re building the trial version, which is useful in order to tweak the Info.plist file. Finally, in the ‘LLVM GCC 4.2 – Preprocessing’ section define ‘Preprocessor Macros’ for the new build configurations and also set them to ‘TRIAL’. By doing this you can use conditional compiling in the source code.
Second: Create a Trial Version Scheme
Now create a new scheme (this is new to Xcode 4, consider it like a summary of build options, read Martin Pilkington on this) by clicking Product/Edit Scheme and then click on the ‘Duplicate Scheme’ button. Name this new scheme ‘trial version’ or something like that. Tell Xcode to use the modified build configurations (debug and/or release) with this scheme, and, if you also change the product name, also the modified (i.e. renamed) executable, as otherwise running the app from within Xcode won’t work.
Now, if you want to build the Mac App Store version of my app, select the original scheme in the Xcode main toolbar. If you want to build the trial version, select the duplicated scheme referring to the modified build configuration.
Third: Edit Info.plist file
So far for the preparatory configuration, now to the true changes between the two build versions, which will be contained in the Info.plist file and in the source code. Right-click on the info.plist file in the navigation area and open it (“Open As”) in source code view (instead of the usual plist view). Then add the following key-value combination somewhere at the end of the file:
This is just an example on how to modify the contents of the Info.plist file [Update: Even better probably to have two different Info.plist files, set their respective names in the packaging build settings]. The code example above is only put in the build product if you build the trial version (by having selected the newly created trial build scheme, see above). To have a different bundle identifier for the trial version is useful as the Mac App Store source code (compiled only into the Mac App Store version) can then check for the trial version and ask if the user wants to delete it. Another possibility is that the trial version checks for the Mac App Store version present and ask the user the same (read Craig Hockenberry on this, who prefers to create a separate target for each version).
Fourth: Add Trial Version Code
In the source code, you now introduce conditional trial version code, which I currently do like this in the AppDelegate [Update April 21, 2012: Previously, I recommended having the following code snippet in the -awakeFromNib method. It turned out that there are issues with the application menu if you do so, therefore I moved the code to the -applicationDidFinishLaunching: method and everything works as it should]:
This code is compiled into the target only if the trial version is built, not if the Mac App Store version is built. It simply checks if the trial is expired or not. If it is, showExpiredMessage shows a notice window and quits, if it isn’t, showRemainingTrialMessage shows a short notice with the remaining trial period. These notices also contain links to open the Mac App Store website in case the user wants to buy the full version. Some more internal methods (not visible in the snippet above) handle storing and retrieving information on the trial period.
I have put all the methods mentioned above in an AppDelegate category so I can drop the category in any of my projects and it will just compile. My way to store the information about the trial period and its expiration is pretty straightforward and by far not bullet-proof. People who want to crack it will likely (and easily) succeed, especially after studying the source code. However, I trust that there are enough honest people out there.
Redeem your gift card for apps, subscriptions, and more.
Redeem a gift card with your iPhone, iPad, iPod touch
- Peel or gently scratch off the label on the back of the gift card to reveal a 16-digit code that starts with X.
- On your iPhone, iPad, or iPod touch, open the App Store app.
- At the bottom of the screen, tap Today.
- At the top of the screen, tap the sign-in button or your photo.
- Tap 'Redeem Gift Card or Code.' If you don’t see “Redeem Gift Card or Code,” sign in with your Apple ID. Learn what to do if you forgot your Apple ID.
- Tap 'Use Camera' and follow the instructions on the screen. If you have trouble redeeming the card, tap 'You can also enter your code manually,' then follow the instructions on the screen. Make sure that you enter the 16-digit code that begins with X.
- Tap Done.
Redeem a gift card on your computer
- Peel or gently scratch off the label on the back of the gift card to reveal a 16-digit code that starts with X.
- On your Mac, open the App Store.
- Click your name or the sign-in button in the sidebar.
- Click 'Redeem Gift Card.'
- Click 'Use Camera' and follow the instructions on the screen. If you have trouble redeeming the card, click 'You can also enter your code manually,' then follow the instructions on the screen. Make sure that you enter the 16-digit code that begins with X.
Using a Windows PC?
If you're using a PC, redeem your gift card in iTunes. From the menu bar at the top of the iTunes window, choose Account, then choose Redeem, then sign in and follow the instructions on the screen.
Redeem a gift card on your Android device
- Peel or gently scratch off the label on the back of the gift card to reveal a 16-digit code that starts with X.
- Open the Apple Music app.
- Tap the menu button , then tap Account.
- Tap 'Redeem Gift Card or Code.'
- Enter the 16-digit code that begins with X. Then tap Redeem.
If you received an App Store & iTunes Gift Card by email
To redeem a gift card that someone emailed to you, open the email and tap or click the 'Redeem Now' button.
What you can buy with this gift card
When you redeem an App Store & iTunes Gift Card, you can make purchases with your Apple ID balance, including apps, games, iCloud storage, subscriptions like Apple Music, and more. But for some purchases, Apple ID balance can't be used. Learn what you can buy with your Apple ID balance.
Mac App Store Redeem Code
On an Android device, you can use your gift card to buy an Apple Music subscription. To make purchases from the App Store, Apple Books, or the Apple TV app, use an Apple device.
Learn more
- You can't check the remaining balance on an App Store & iTunes Gift Card. But you can check your Apple ID balance. Your Apple ID balance includes the balance from any App Store & iTunes Gift Cards that you have redeemed.
- Some purchases might require that you have a credit card on file, even if you use Apple ID balance to make the purchase.
- You can’t use Apple Store Gift Cards in the App Store or iTunes Store. Apple Store Gift Cards are a solid color (gray, white, silver, or gold) on the front. Find out what to do if you don't know what type of gift card you have.
Apple Mac App Store App
App Store & iTunes Gift Cards aren't available in all countries or regions. Find out if you can use gift cards in your country or region.
Visual Studio Code Mac App Store
App Store and iTunes Store features might vary by country or region. Find out what's available in your country or region.