When I created the game Asteroids Blast I ran into the problems with testing of In-App purchases on the macOS platform: I successfully built an application, but in-app purchases did not work. Spending some time I solved the problem and now I want to share with you a simple step by step list on how to make it work.
For building my project I used Unity 2019.3.13f and In-App Purchasing package version 2.0.6, so in the future some of these steps may be changed.
So let’s go:
- Open Build Settings, check
Create Xcode Project
and build it; - Open Xcode project;
- Choose Project Target;
- In tab
General
setBundle Identifier
to yours (it not auto set from Unity); - In tab
Signing & Capabilities
:- setup Signing
- Add Capability “In-App Purchase”
- Add Capability “App Sandbox” and check “Outgoing Connections (Client)”
- In tab
Build Phases
addNew Copy Files Phase
:Destination
set toPlugIns
;- In project folder find
Plugins/unitypurchasing.bundle
and drag-n-drop it to files list
On this step you’ll be able to build project and test purchases in Sandbox.
Before uploading to AppStore you need to make the next steps:
- Find file:
Plugins/unitypurchasing.bundle
, right-click on it and chooseShow Package Contents
; - Then find file:
Contents/Info.plist
and edit it; - Replace
com.unity.purchasing.unitypurchasing
to any other value, for exampleYOUR_BUNDLE_ID.unitypurchasing
Now project ready to archive and upload to AppStore.